From ff7ecf5e54eff213af59fb4ef4be9e64a4fedcb3 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 7 Jul 2014 10:54:10 -0500 Subject: [PATCH] Test active addresses including script addrs. --- wallet/wallet_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/wallet/wallet_test.go b/wallet/wallet_test.go index da018f2..b2d0855 100644 --- a/wallet/wallet_test.go +++ b/wallet/wallet_test.go @@ -994,6 +994,23 @@ func TestImportScript(t *testing.T) { 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. // Test (de)serialization of wallet. @@ -1082,6 +1099,25 @@ func TestImportScript(t *testing.T) { 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 // the import height and the chain height. partialHeight := (createHeight-importHeight)/2 + importHeight