| 参数 | 符号 | 数值 / 来源 | 说明 |
|---|---|---|---|
| Coinbase 成熟区块数 | M | 100 区块 | 类似 Bitcoin 的 coinbase 成熟度 |
| Lockbox 地址 | — | 0x0000000000000000000000000000000000000042 | 保留的系统账户 |
| 键前缀 | — | "maturity:addr:","maturity:amt:" | Keccak256(prefix || 大端 height) |
Finalize(header, state):
h = header.number
R = calcBlockReward(h)
M = 100 blocks
if R > 0:
putScheduledPayout(state, h + M, header.coinbase, R)
if due(h):
(addr, amt) = popDuePayout(state, h)
state.AddBalance(addr, amt)
header.Root = state.IntermediateRoot(...)
schedKeyAddr(H):
b = bigEndianUint64(H)
return keccak256("maturity:addr:" || b)
schedKeyAmt(H):
b = bigEndianUint64(H)
return keccak256("maturity:amt:" || b)
N: mine block, schedule payout for U=N+M
...
U-1: pending only
U: popDuePayout → AddBalance(addr_U, amt_U) → clear slots
U+1: nothing due for U anymore
popDuePayout(state, H):
rawAmt = state.Get(lockbox, schedKeyAmt(H))
if rawAmt == 0: return (zero, 0, false)
rawAddr = state.Get(lockbox, schedKeyAddr(H))
state.Set(lockbox, schedKeyAmt(H), 0)
state.Set(lockbox, schedKeyAddr(H), 0)
return (Address(rawAddr), BigInt(rawAmt), true)
ReorgTo(newTip):
rewind state → parent of fork
for block in pathTo(newTip):
Execute(block) // schedules & payouts naturally recompute
for h in [current..current+K]:
if getState(lockbox, schedKeyAmt(h)) != 0:
// list upcoming payout at height h