@@ -1144,6 +1144,15 @@ function acceptStatusOkObject(ctx) {
11441144 return ! ! ( ctx . rpcResult && typeof ctx . rpcResult . result === "object" && ctx . rpcResult . result && ctx . rpcResult . result . status === "OK" ) ;
11451145}
11461146
1147+ // Tari SubmitBlock returns result.block_hash without status OK on success.
1148+ // Treating it as generic object result makes valid XTM blocks retry and alert.
1149+ function acceptXtmBlockHashResult ( ctx ) {
1150+ if ( ! ctx . rpcResult || typeof ctx . rpcResult . result !== "object" || ! ctx . rpcResult . result ) return false ;
1151+ const blockHash = ctx . rpcResult . result . block_hash ;
1152+ if ( Array . isArray ( blockHash ) || Buffer . isBuffer ( blockHash ) ) return blockHash . length > 0 ;
1153+ return typeof blockHash === "string" && blockHash . length > 0 ;
1154+ }
1155+
11471156function acceptNonRejectedResponse ( ctx ) { return ! ! ( ctx . rpcResult && ctx . rpcResult . response !== "rejected" ) ; }
11481157
11491158function acceptAccepted202String ( ctx ) { return typeof ctx . rpcResult === "string" && ctx . rpcStatus == 202 ; }
@@ -1176,7 +1185,10 @@ function resolveEthSubmittedBlockHash(ctx, callback) {
11761185}
11771186
11781187function resolveXtmSubmittedBlockHash ( ctx , callback ) {
1179- return callback ( Buffer . from ( ctx . rpcResult . result . block_hash ) . toString ( "hex" ) ) ;
1188+ const blockHash = ctx . rpcResult && ctx . rpcResult . result && ctx . rpcResult . result . block_hash ;
1189+ if ( Array . isArray ( blockHash ) || Buffer . isBuffer ( blockHash ) ) return callback ( Buffer . from ( blockHash ) . toString ( "hex" ) ) ;
1190+ if ( typeof blockHash === "string" ) return callback ( blockHash ) ;
1191+ return callback ( "0" . repeat ( 64 ) ) ;
11801192}
11811193
11821194function submitCryptonoteBlock ( ctx ) {
@@ -1344,6 +1356,7 @@ const pool = {
13441356 submitSuccess : "boolean" ,
13451357 sendLoginResult : sendXtmCLoginResult ,
13461358 verifySpecialShare : verifyXtmCShare ,
1359+ acceptSubmittedBlock : acceptXtmBlockHashResult ,
13471360 resolveSubmittedBlockHash : resolveXtmSubmittedBlockHash ,
13481361 submitBlockRpc : submitXtmCBlock ,
13491362 jobAlgo : "cuckaroo" ,
@@ -1353,6 +1366,7 @@ const pool = {
13531366} ;
13541367pool . submitAccept = Object . freeze ( {
13551368 statusOkObject : acceptStatusOkObject ,
1369+ xtmBlockHashResult : acceptXtmBlockHashResult ,
13561370 accepted202String : acceptAccepted202String
13571371} ) ;
13581372pool . blockHash = Object . freeze ( {
0 commit comments