diff --git a/src/wallet/gtest/test_wallet.cpp b/src/wallet/gtest/test_wallet.cpp index 70ec7e4ce..957dc4d2d 100644 --- a/src/wallet/gtest/test_wallet.cpp +++ b/src/wallet/gtest/test_wallet.cpp @@ -1027,6 +1027,7 @@ TEST(wallet_tests, UpdatedNoteData) { // Pretend we mined the tx by adding a fake witness ZCIncrementalMerkleTree tree; wtx.mapNoteData[jsoutpt].witnesses.push_front(tree.witness()); + wtx.mapNoteData[jsoutpt].witnessHeight = 100; // Now pretend we added the key for the second note, and // the tx was "added" to the wallet again to update it. @@ -1039,11 +1040,13 @@ TEST(wallet_tests, UpdatedNoteData) { // The txs should initially be different EXPECT_NE(wtx.mapNoteData, wtx2.mapNoteData); EXPECT_EQ(1, wtx.mapNoteData[jsoutpt].witnesses.size()); + EXPECT_EQ(100, wtx.mapNoteData[jsoutpt].witnessHeight); // After updating, they should be the same EXPECT_TRUE(wallet.UpdatedNoteData(wtx2, wtx)); EXPECT_EQ(wtx.mapNoteData, wtx2.mapNoteData); EXPECT_EQ(1, wtx.mapNoteData[jsoutpt].witnesses.size()); + EXPECT_EQ(100, wtx.mapNoteData[jsoutpt].witnessHeight); // TODO: The new note should get witnessed (but maybe not here) (#1350) } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index dba9d5890..6f7372ade 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1106,6 +1106,7 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) tmp.at(nd.first).witnesses.assign( nd.second.witnesses.cbegin(), nd.second.witnesses.cend()); } + tmp.at(nd.first).witnessHeight = nd.second.witnessHeight; } // Now copy over the updated note data wtx.mapNoteData = tmp;