dealing with missing 'code' keys in customNetPrealloc

This commit is contained in:
jangko 2021-03-31 13:42:12 +07:00
parent fb7d5b5319
commit 1801317208
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
1 changed files with 6 additions and 1 deletions

View File

@ -40,9 +40,14 @@ proc customNetPrealloc(genesisBlock: JsonNode): GenesisAlloc =
else:
AccountNonce(0)
let code = if "code" in account:
hexToSeqByte(account["code"].getStr)
else:
@[]
var acc = GenesisAccount(
balance: fromHex(UInt256, account["balance"].getStr),
code: hexToSeqByte(account["code"].getStr),
code: code,
nonce: nonce
)