Skip to content

Commit

Permalink
Merge PIVX-Project#2123: [Test] Attempt to fix the diversified addres…
Browse files Browse the repository at this point in the history
…s equal to default address test scenario

910b580 Test case: StoreAndLoadSaplingZkeys, added a loop to try to generate a diversified address different than the default one. (furszy)

Pull request description:

  Follow up investigation to PIVX-Project#2116. Based on GA results, the diversified address is equal to the default address.
  The code now will try to create a different address to the default one in a loop increasing the diversifier by one on each round.

  This issue will need a deeper investigation in the future if/when we add diversified addresses features (at this moment, is pretty irrelevant as we aren't using diversified addresses at all). I have seen it only happening randomly on GA on linux and doesn't seems to be a library issue, if we provide the same seed to the process, the error isn't being thrown. It seems more to be an issue with the data pointer.

ACKs for top commit:
  random-zebra:
    utACK 910b580

Tree-SHA512: 8be1c093c63c648741f7cf2b1179e41314b1b77daf418b0df042996a19085d81db078aae563c51926b8534b99ebbe9930badf23ecd65a81ae255f3500bf95fe4
  • Loading branch information
random-zebra committed Jan 5, 2021
2 parents 2a736a8 + 910b580 commit 9d935a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test/librust/wallet_zkeys_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ BOOST_AUTO_TEST_CASE(StoreAndLoadSaplingZkeys) {
// verify wallet only has the default address
libzcash::SaplingPaymentAddress defaultAddr = sk.DefaultAddress();
BOOST_CHECK(wallet.HaveSaplingIncomingViewingKey(defaultAddr));
BOOST_CHECK_MESSAGE(!(dpa == defaultAddr), "ERROR: default address is equal to diversified address");

// Keep trying different diversifiers until we get a different address
while (dpa == defaultAddr && diversifier.begin()[0] < 255) {
diversifier.begin()[0] += 1;
dpa = sk.ToXFVK().Address(diversifier).get().second;
}
BOOST_CHECK(!wallet.HaveSaplingIncomingViewingKey(dpa));

// manually add a diversified address
Expand Down

0 comments on commit 9d935a9

Please sign in to comment.