|
|
@ -384,7 +384,7 @@ TEST(WalletTests, SetSaplingNoteAddrsInCWalletTx) { |
|
|
|
|
|
|
|
auto builder = TransactionBuilder(consensusParams, 1); |
|
|
|
ASSERT_TRUE(builder.AddSaplingSpend(expsk, note, anchor, witness)); |
|
|
|
builder.AddSaplingOutput(fvk, pk, 50000, {}); |
|
|
|
builder.AddSaplingOutput(fvk.ovk, pk, 50000, {}); |
|
|
|
builder.SetFee(0); |
|
|
|
auto maybe_tx = builder.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx), true); |
|
|
@ -504,7 +504,7 @@ TEST(WalletTests, FindMySaplingNotes) { |
|
|
|
// Generate transaction
|
|
|
|
auto builder = TransactionBuilder(consensusParams, 1); |
|
|
|
ASSERT_TRUE(builder.AddSaplingSpend(expsk, note, anchor, witness)); |
|
|
|
builder.AddSaplingOutput(fvk, pk, 25000, {}); |
|
|
|
builder.AddSaplingOutput(fvk.ovk, pk, 25000, {}); |
|
|
|
auto maybe_tx = builder.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx), true); |
|
|
|
auto tx = maybe_tx.get(); |
|
|
@ -644,7 +644,7 @@ TEST(WalletTests, GetConflictedSaplingNotes) { |
|
|
|
// Generate tx to create output note B
|
|
|
|
auto builder = TransactionBuilder(consensusParams, 1); |
|
|
|
ASSERT_TRUE(builder.AddSaplingSpend(expsk, note, anchor, witness)); |
|
|
|
builder.AddSaplingOutput(fvk, pk, 35000, {}); |
|
|
|
builder.AddSaplingOutput(fvk.ovk, pk, 35000, {}); |
|
|
|
auto maybe_tx = builder.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx), true); |
|
|
|
auto tx = maybe_tx.get(); |
|
|
@ -700,7 +700,7 @@ TEST(WalletTests, GetConflictedSaplingNotes) { |
|
|
|
// Create transaction to spend note B
|
|
|
|
auto builder2 = TransactionBuilder(consensusParams, 2); |
|
|
|
ASSERT_TRUE(builder2.AddSaplingSpend(expsk, note2, anchor, spend_note_witness)); |
|
|
|
builder2.AddSaplingOutput(fvk, pk, 20000, {}); |
|
|
|
builder2.AddSaplingOutput(fvk.ovk, pk, 20000, {}); |
|
|
|
auto maybe_tx2 = builder2.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx2), true); |
|
|
|
auto tx2 = maybe_tx2.get(); |
|
|
@ -708,7 +708,7 @@ TEST(WalletTests, GetConflictedSaplingNotes) { |
|
|
|
// Create conflicting transaction which also spends note B
|
|
|
|
auto builder3 = TransactionBuilder(consensusParams, 2); |
|
|
|
ASSERT_TRUE(builder3.AddSaplingSpend(expsk, note2, anchor, spend_note_witness)); |
|
|
|
builder3.AddSaplingOutput(fvk, pk, 19999, {}); |
|
|
|
builder3.AddSaplingOutput(fvk.ovk, pk, 19999, {}); |
|
|
|
auto maybe_tx3 = builder3.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx3), true); |
|
|
|
auto tx3 = maybe_tx3.get(); |
|
|
@ -809,7 +809,7 @@ TEST(WalletTests, SaplingNullifierIsSpent) { |
|
|
|
// Generate transaction
|
|
|
|
auto builder = TransactionBuilder(consensusParams, 1); |
|
|
|
ASSERT_TRUE(builder.AddSaplingSpend(expsk, note, anchor, witness)); |
|
|
|
builder.AddSaplingOutput(fvk, pk, 25000, {}); |
|
|
|
builder.AddSaplingOutput(fvk.ovk, pk, 25000, {}); |
|
|
|
auto maybe_tx = builder.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx), true); |
|
|
|
auto tx = maybe_tx.get(); |
|
|
@ -906,7 +906,7 @@ TEST(WalletTests, NavigateFromSaplingNullifierToNote) { |
|
|
|
// Generate transaction
|
|
|
|
auto builder = TransactionBuilder(consensusParams, 1); |
|
|
|
ASSERT_TRUE(builder.AddSaplingSpend(expsk, note, anchor, witness)); |
|
|
|
builder.AddSaplingOutput(fvk, pk, 25000, {}); |
|
|
|
builder.AddSaplingOutput(fvk.ovk, pk, 25000, {}); |
|
|
|
auto maybe_tx = builder.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx), true); |
|
|
|
auto tx = maybe_tx.get(); |
|
|
@ -1042,7 +1042,7 @@ TEST(WalletTests, SpentSaplingNoteIsFromMe) { |
|
|
|
// Generate transaction, which sends funds to note B
|
|
|
|
auto builder = TransactionBuilder(consensusParams, 1); |
|
|
|
ASSERT_TRUE(builder.AddSaplingSpend(expsk, note, anchor, witness)); |
|
|
|
builder.AddSaplingOutput(fvk, pk, 25000, {}); |
|
|
|
builder.AddSaplingOutput(fvk.ovk, pk, 25000, {}); |
|
|
|
auto maybe_tx = builder.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx), true); |
|
|
|
auto tx = maybe_tx.get(); |
|
|
@ -1114,7 +1114,7 @@ TEST(WalletTests, SpentSaplingNoteIsFromMe) { |
|
|
|
// Create transaction to spend note B
|
|
|
|
auto builder2 = TransactionBuilder(consensusParams, 2); |
|
|
|
ASSERT_TRUE(builder2.AddSaplingSpend(expsk, note2, anchor, spend_note_witness)); |
|
|
|
builder2.AddSaplingOutput(fvk, pk, 12500, {}); |
|
|
|
builder2.AddSaplingOutput(fvk.ovk, pk, 12500, {}); |
|
|
|
auto maybe_tx2 = builder2.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx2), true); |
|
|
|
auto tx2 = maybe_tx2.get(); |
|
|
@ -1744,7 +1744,7 @@ TEST(WalletTests, UpdatedSaplingNoteData) { |
|
|
|
// Generate transaction
|
|
|
|
auto builder = TransactionBuilder(consensusParams, 1); |
|
|
|
ASSERT_TRUE(builder.AddSaplingSpend(expsk, note, anchor, witness)); |
|
|
|
builder.AddSaplingOutput(fvk, pk2, 25000, {}); |
|
|
|
builder.AddSaplingOutput(fvk.ovk, pk2, 25000, {}); |
|
|
|
auto maybe_tx = builder.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx), true); |
|
|
|
auto tx = maybe_tx.get(); |
|
|
@ -1894,7 +1894,7 @@ TEST(WalletTests, MarkAffectedSaplingTransactionsDirty) { |
|
|
|
// 0.0005 t-ZEC in, 0.0004 z-ZEC out, 0.0001 t-ZEC fee
|
|
|
|
auto builder = TransactionBuilder(consensusParams, 1, &keystore); |
|
|
|
builder.AddTransparentInput(COutPoint(), scriptPubKey, 50000); |
|
|
|
builder.AddSaplingOutput(fvk, pk, 40000, {}); |
|
|
|
builder.AddSaplingOutput(fvk.ovk, pk, 40000, {}); |
|
|
|
auto maybe_tx = builder.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx), true); |
|
|
|
auto tx1 = maybe_tx.get(); |
|
|
@ -1951,7 +1951,7 @@ TEST(WalletTests, MarkAffectedSaplingTransactionsDirty) { |
|
|
|
// 0.0004 z-ZEC in, 0.00025 z-ZEC out, 0.0001 t-ZEC fee, 0.00005 z-ZEC change
|
|
|
|
auto builder2 = TransactionBuilder(consensusParams, 2); |
|
|
|
ASSERT_TRUE(builder2.AddSaplingSpend(expsk, note, anchor, witness)); |
|
|
|
builder2.AddSaplingOutput(fvk, pk, 25000, {}); |
|
|
|
builder2.AddSaplingOutput(fvk.ovk, pk, 25000, {}); |
|
|
|
auto maybe_tx2 = builder2.Build(); |
|
|
|
ASSERT_EQ(static_cast<bool>(maybe_tx2), true); |
|
|
|
auto tx2 = maybe_tx2.get(); |
|
|
|