@@ -20,7 +20,8 @@ let broadcastedTransactions = [];
2020
2121// Results
2222let allPeersReachedTargetBlockNumber = false ;
23- let allTransactionsReportedByApi = true ;
23+ let allTransactionsReportedByApi = false ;
24+ let allTransactionsSuccessful = true ;
2425
2526const peerBlockNumberMap = new Map ( ) ;
2627
@@ -39,16 +40,21 @@ const peerBlockNumberMap = new Map();
3940async function waitForResults ( ) {
4041 do {
4142 await sleep ( 1000 ) ;
42- console . log ( "waiting for results..." , { allPeersReachedTargetBlockNumber, allTransactionsReportedByApi } ) ;
43+ console . log ( "waiting for results..." , { allPeersReachedTargetBlockNumber, allTransactionsReportedByApi, allTransactionsSuccessful } ) ;
4344
4445 if ( ! allTransactionsReportedByApi ) {
4546 try {
4647 let allFound = true ;
4748 for ( const hash of broadcastedTransactions ) {
4849 const transaction = await getApiHttp ( config . peer , `/transactions/${ hash } ` ) ;
4950 if ( ! transaction ) {
50- allFound = false ;
51- break ;
51+ allFound = false ;
52+ break ;
53+ }
54+
55+ if ( transaction . data . receipt . status !== 1 ) {
56+ console . log ( "transaction failed!!" , transaction . data ) ;
57+ allTransactionsSuccessful = false ;
5258 }
5359 }
5460
@@ -62,7 +68,7 @@ async function waitForResults() {
6268
6369 console . log ( `checks successful. exiting` ) ;
6470
65- process . exit ( 0 ) ;
71+ process . exit ( allTransactionsSuccessful ? 0 : 1 ) ;
6672}
6773
6874async function broadcastTransactions ( ) {
0 commit comments