File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1401,3 +1401,31 @@ fn test_get_first_seen_of_a_tx() {
14011401 let first_seen = graph. get_tx_node ( txid) . unwrap ( ) . first_seen ;
14021402 assert_eq ! ( first_seen, Some ( seen_at) ) ;
14031403}
1404+
1405+ #[ test]
1406+ fn test_get_first_seen_of_a_tx ( ) {
1407+ let mut graph = TxGraph :: < BlockId > :: default ( ) ;
1408+
1409+ let tx = Transaction {
1410+ version : transaction:: Version :: ONE ,
1411+ lock_time : absolute:: LockTime :: ZERO ,
1412+ input : vec ! [ TxIn {
1413+ previous_output: OutPoint :: null( ) ,
1414+ ..Default :: default ( )
1415+ } ] ,
1416+ output : vec ! [ TxOut {
1417+ value: Amount :: from_sat( 50_000 ) ,
1418+ script_pubkey: ScriptBuf :: new( ) ,
1419+ } ] ,
1420+ } ;
1421+ let txid = tx. compute_txid ( ) ;
1422+ let seen_at = 1_000_000_u64 ;
1423+
1424+ let changeset_tx = graph. insert_tx ( Arc :: new ( tx) ) ;
1425+ graph. apply_changeset ( changeset_tx) ;
1426+ let changeset_seen = graph. insert_seen_at ( txid, seen_at) ;
1427+ graph. apply_changeset ( changeset_seen) ;
1428+
1429+ let first_seen = graph. get_tx_node ( txid) . unwrap ( ) . first_seen ;
1430+ assert_eq ! ( first_seen, Some ( seen_at) ) ;
1431+ }
You can’t perform that action at this time.
0 commit comments