@@ -324,7 +324,31 @@ def run_test(self):
324324 # Balance of node 0 is: prev_balance - 1 PIV (+fee) sent externally + 250 PIV matured coinbase
325325 assert_equal (self .nodes [0 ].getbalance (), satoshi_round (prev_balance + Decimal ('249' ) - Decimal (fee )))
326326
327+ # Now shield some funds using sendtoaddress
328+ self .log .info ("TX12: Shielding coins with sendtoaddress RPC..." )
329+ prev_balance = self .nodes [0 ].getbalance ()
330+ mytxid12 = self .nodes [0 ].sendtoaddress (saplingAddr0 , Decimal ('10' ))
331+ self .check_tx_priority ([mytxid12 ])
332+ self .log .info ("Done. Checking details and balances..." )
333+
334+ # Decrypted transaction details should be correct
335+ pt = self .nodes [0 ].viewshieldedtransaction (mytxid12 )
336+ fee = pt ["fee" ]
337+ assert_equal (pt ['txid' ], mytxid12 )
338+ assert_equal (len (pt ['spends' ]), 0 )
339+ assert_equal (len (pt ['outputs' ]), 1 )
340+ out = pt ['outputs' ][0 ]
341+ assert_equal (out ['address' ], saplingAddr0 )
342+ assert_equal (out ['outgoing' ], False )
343+ assert_equal (out ['value' ], Decimal ('10' ))
344+
345+ # Verify balance
346+ self .nodes [2 ].generate (1 )
347+ self .sync_all ()
348+ assert_equal (self .nodes [0 ].getshieldedbalance (saplingAddr0 ), Decimal ('29' )) # 19 prev balance + 10 received
349+
327350 self .log .info ("All good." )
328351
352+
329353if __name__ == '__main__' :
330354 WalletSaplingTest ().main ()
0 commit comments