@@ -1443,7 +1443,7 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} {
1443
1443
// RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are
1444
1444
// returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain
1445
1445
// transaction hashes.
1446
- func RPCMarshalBlock (block * types.Block , inclTx bool , fullTx bool , config * params.ChainConfig ) ( map [string ]interface {}, error ) {
1446
+ func RPCMarshalBlock (block * types.Block , inclTx bool , fullTx bool , config * params.ChainConfig ) map [string ]interface {} {
1447
1447
fields := RPCMarshalHeader (block .Header ())
1448
1448
fields ["size" ] = hexutil .Uint64 (block .Size ())
1449
1449
@@ -1469,18 +1469,17 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param
1469
1469
uncleHashes [i ] = uncle .Hash ()
1470
1470
}
1471
1471
fields ["uncles" ] = uncleHashes
1472
- return fields , nil
1472
+ return fields
1473
1473
}
1474
1474
1475
1475
// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires
1476
1476
// a `BlockChainAPI`.
1477
1477
func (s * BlockChainAPI ) rpcMarshalBlock (b * types.Block , inclTx bool , fullTx bool ) (map [string ]interface {}, error ) {
1478
- fields , err := RPCMarshalBlock (b , inclTx , fullTx , s .b .ChainConfig ())
1479
- if err != nil {
1480
- return nil , err
1478
+ fields := RPCMarshalBlock (b , inclTx , fullTx , s .b .ChainConfig ())
1479
+ if inclTx {
1480
+ fields [ "totalDifficulty" ] = ( * hexutil . Big )( s . b . GetTd ( context . Background (), b . Hash ()))
1481
1481
}
1482
- fields ["totalDifficulty" ] = (* hexutil .Big )(s .b .GetTd (context .Background (), b .Hash ()))
1483
- return fields , err
1482
+ return fields , nil
1484
1483
}
1485
1484
1486
1485
// findNearestSignedBlock finds the nearest checkpoint from input block
0 commit comments