Copy over CNoteData::witnessHeight when updating wallet tx
This commit is contained in:
parent
40ef121e6a
commit
4a6a48479d
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue