forked from cerc-io/plugeth
Fix block size output #613
This commit is contained in:
parent
6e8ff578f1
commit
ac03ff6f05
@ -17,6 +17,10 @@ func (self StorageSize) String() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self StorageSize) Int64() int64 {
|
||||||
|
return int64(self)
|
||||||
|
}
|
||||||
|
|
||||||
// The different number of units
|
// The different number of units
|
||||||
var (
|
var (
|
||||||
Douglas = BigPow(10, 42)
|
Douglas = BigPow(10, 42)
|
||||||
|
@ -49,7 +49,7 @@ func NewBlockRes(block *types.Block, fullTx bool) *BlockRes {
|
|||||||
res.Miner = newHexData(block.Header().Coinbase)
|
res.Miner = newHexData(block.Header().Coinbase)
|
||||||
res.Difficulty = newHexNum(block.Difficulty())
|
res.Difficulty = newHexNum(block.Difficulty())
|
||||||
res.TotalDifficulty = newHexNum(block.Td)
|
res.TotalDifficulty = newHexNum(block.Td)
|
||||||
res.Size = newHexNum(block.Size())
|
res.Size = newHexNum(block.Size().Int64())
|
||||||
res.ExtraData = newHexData(block.Header().Extra)
|
res.ExtraData = newHexData(block.Header().Extra)
|
||||||
res.GasLimit = newHexNum(block.GasLimit())
|
res.GasLimit = newHexNum(block.GasLimit())
|
||||||
// res.MinGasPrice =
|
// res.MinGasPrice =
|
||||||
|
@ -18,6 +18,7 @@ const (
|
|||||||
reAddress = `"0x[0-9a-f]{40}"` // 20 bytes
|
reAddress = `"0x[0-9a-f]{40}"` // 20 bytes
|
||||||
reAddressOpt = `"0x[0-9a-f]{40}"|null` // 20 bytes or null
|
reAddressOpt = `"0x[0-9a-f]{40}"|null` // 20 bytes or null
|
||||||
reNum = `"0x([1-9a-f][0-9a-f]{0,15})|0"` // must not have left-padded zeros
|
reNum = `"0x([1-9a-f][0-9a-f]{0,15})|0"` // must not have left-padded zeros
|
||||||
|
reNumNonZero = `"0x([1-9a-f][0-9a-f]{0,15})"` // non-zero required must not have left-padded zeros
|
||||||
reNumOpt = `"0x([1-9a-f][0-9a-f]{0,15})|0"|null` // must not have left-padded zeros or null
|
reNumOpt = `"0x([1-9a-f][0-9a-f]{0,15})|0"|null` // must not have left-padded zeros or null
|
||||||
reData = `"0x[0-9a-f]*"` // can be "empty"
|
reData = `"0x[0-9a-f]*"` // can be "empty"
|
||||||
)
|
)
|
||||||
@ -42,7 +43,7 @@ func TestNewBlockRes(t *testing.T) {
|
|||||||
"miner": reAddress,
|
"miner": reAddress,
|
||||||
"difficulty": `"0x1"`,
|
"difficulty": `"0x1"`,
|
||||||
"totalDifficulty": reNum,
|
"totalDifficulty": reNum,
|
||||||
"size": reNum,
|
"size": reNumNonZero,
|
||||||
"extraData": reData,
|
"extraData": reData,
|
||||||
"gasLimit": reNum,
|
"gasLimit": reNum,
|
||||||
// "minGasPrice": "0x",
|
// "minGasPrice": "0x",
|
||||||
|
Loading…
Reference in New Issue
Block a user