@ -16,22 +16,26 @@ func TestAllowedTxsParse(t *testing.T) {
one1s4dvv454dtmkzsulffz3epewsyhrjq9y0g3fqz - > 0x985458E523dB3d53125813eD68c274899e9DfAb4 : 0xa9059cbb
one1s4dvv454dtmkzsulffz3epewsyhrjq9y0g3fqz - > 0x985458E523dB3d53125813eD68c274899e9DfAb4 : 0xa9059cbb
one1s4dvv454dtmkzsulffz3epewsyhrjq9y0g3fqz - > one10fhdp2g9q5azrs2ukk608x6krd4rleg0ueskug : 0 x
one1s4dvv454dtmkzsulffz3epewsyhrjq9y0g3fqz - > one10fhdp2g9q5azrs2ukk608x6krd4rleg0ueskug : 0 x
` )
` )
expected := map [ ethCommon . Address ] core . AllowedTxData {
expected := map [ ethCommon . Address ] [ ] core . AllowedTxData {
common . HexToAddress ( "0x7A6Ed0a905053A21C15cB5b4F39b561B6A3FE50f" ) : core . AllowedTxData {
common . HexToAddress ( "0x7A6Ed0a905053A21C15cB5b4F39b561B6A3FE50f" ) : {
To : common . HexToAddress ( "0x855Ac656956AF761439f4a451c872E812E3900a4" ) ,
core . AllowedTxData {
Data : common . FromHex ( "0x" ) ,
To : common . HexToAddress ( "0x855Ac656956AF761439f4a451c872E812E3900a4" ) ,
Data : common . FromHex ( "0x" ) ,
} ,
core . AllowedTxData {
To : common . HexToAddress ( "0x985458E523dB3d53125813eD68c274899e9DfAb4" ) ,
Data : common . FromHex ( "0xa9059cbb" ) ,
} ,
} ,
} ,
common . HexToAddress ( "0x7A6Ed0a905053A21C15cB5b4F39b561B6A3FE50f" ) : core . AllowedTxData {
common . HexToAddress ( "0x855Ac656956AF761439f4a451c872E812E3900a4" ) : {
To : common . HexToAddress ( "0x985458E523dB3d53125813eD68c274899e9DfAb4" ) ,
core . AllowedTxData {
Data : common . FromHex ( "0xa9059cbb" ) ,
To : common . HexToAddress ( "0x985458E523dB3d53125813eD68c274899e9DfAb4" ) ,
} ,
Data : common . FromHex ( "0xa9059cbb" ) ,
common . HexToAddress ( "0x855Ac656956AF761439f4a451c872E812E3900a4" ) : core . AllowedTxData {
} ,
To : common . HexToAddress ( "0x985458E523dB3d53125813eD68c274899e9DfAb4" ) ,
core . AllowedTxData {
Data : common . FromHex ( "0xa9059cbb" ) ,
To : common . HexToAddress ( "0x7A6Ed0a905053A21C15cB5b4F39b561B6A3FE50f" ) ,
} ,
Data : common . FromHex ( "0x" ) ,
common . HexToAddress ( "0x855Ac656956AF761439f4a451c872E812E3900a4" ) : core . AllowedTxData {
} ,
To : common . HexToAddress ( "0x7A6Ed0a905053A21C15cB5b4F39b561B6A3FE50f" ) ,
Data : common . FromHex ( "0x" ) ,
} ,
} ,
}
}
got , err := parseAllowedTxs ( testData )
got , err := parseAllowedTxs ( testData )
@ -41,10 +45,12 @@ func TestAllowedTxsParse(t *testing.T) {
if len ( got ) != len ( expected ) {
if len ( got ) != len ( expected ) {
t . Errorf ( "lenght of allowed transactions not equal, got: %d expected: %d" , len ( got ) , len ( expected ) )
t . Errorf ( "lenght of allowed transactions not equal, got: %d expected: %d" , len ( got ) , len ( expected ) )
}
}
for from , txData := range got {
for from , txsData := range got {
expectedTxData := expected [ from ]
for i , txData := range txsData {
if expectedTxData . To != txData . To || ! bytes . Equal ( expectedTxData . Data , txData . Data ) {
expectedTxData := expected [ from ] [ i ]
t . Errorf ( "txData not equal: got: %v expected: %v" , txData , expectedTxData )
if expectedTxData . To != txData . To || ! bytes . Equal ( expectedTxData . Data , txData . Data ) {
t . Errorf ( "txData not equal: got: %v expected: %v" , txData , expectedTxData )
}
}
}
}
}
}
}