From e8c8823bfe2967dbc148b54c34b85ac183017862 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 21 Jan 2014 17:05:54 -0500 Subject: [PATCH] Fix a bookkeeping error on watching wallet exports. The exported watching wallet would include all imported addresses' chain indexes added to the chain index map. Imported addresses are special as they do not belong to the address chain, and this would cause issues when serializing the wallet. --- wallet/wallet.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wallet/wallet.go b/wallet/wallet.go index caae0a0..fc55ba1 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -1303,7 +1303,9 @@ func (w *Wallet) ExportWatchingWallet() (*Wallet, error) { } for apkh, addr := range w.addrMap { apkhCopy := apkh - ww.chainIdxMap[addr.chainIndex] = &apkhCopy + if addr.chainIndex != importedKeyChainIdx { + ww.chainIdxMap[addr.chainIndex] = &apkhCopy + } ww.addrMap[apkhCopy] = addr.watchingCopy() } for apkh, cmt := range w.addrCommentMap {