Test active addresses including script addrs.

This commit is contained in:
Josh Rickmar 2014-07-07 10:54:10 -05:00
parent 5a3be85bf4
commit ff7ecf5e54

View file

@ -994,6 +994,23 @@ func TestImportScript(t *testing.T) {
return return
} }
// Check that it's included along with the active payment addresses.
found := false
for _, wa := range w.SortedActiveAddresses() {
if wa.Address() == address {
found = true
break
}
}
if !found {
t.Errorf("Imported script address was not returned with sorted active payment addresses.")
return
}
if _, ok := w.ActiveAddresses()[address]; !ok {
t.Errorf("Imported script address was not returned with unsorted active payment addresses.")
return
}
// serialise and deseralise and check still there. // serialise and deseralise and check still there.
// Test (de)serialization of wallet. // Test (de)serialization of wallet.
@ -1082,6 +1099,25 @@ func TestImportScript(t *testing.T) {
return return
} }
// Check that it's included along with the active payment addresses.
found = false
for _, wa := range w.SortedActiveAddresses() {
if wa.Address() == address {
found = true
break
}
}
if !found {
t.Errorf("After reserialiation, imported script address was not returned with sorted " +
"active payment addresses.")
return
}
if _, ok := w.ActiveAddresses()[address]; !ok {
t.Errorf("After reserialiation, imported script address was not returned with unsorted " +
"active payment addresses.")
return
}
// Mark imported address as partially synced with a block somewhere inbetween // Mark imported address as partially synced with a block somewhere inbetween
// the import height and the chain height. // the import height and the chain height.
partialHeight := (createHeight-importHeight)/2 + importHeight partialHeight := (createHeight-importHeight)/2 + importHeight