mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Fix exit table, set delayed_withdrawn in exits
- In exit table, `instant_withdrawn`, `delayed_withdraw_request`, and
`delayed_withdrawn` were referencing batch_num. But these actions happen
outside a batch, so they should reference a block_num.
- Process delayed withdrawns:
- In Synchronizer, first match a Rollup delayed withdrawn request, with the
WDelayer deposit (via TxHash), and store the owner and token associated
with the delayed withdrawn.
- In HistoryDB: store the owner and token of a delayed withdrawal request
in the exit_tree, and set delayed_withdrawn when the withdraw is done in
the WDelayer.
- Update dependency of sqlx to master
- Last release of sqlx is from 2018 October, and it doesn't support
`NamedQuery` with a slice of structs, which is used in this commit.
This commit is contained in:
@@ -91,6 +91,7 @@ type RollupEventWithdraw struct {
|
||||
Idx uint64
|
||||
NumExitRoot uint64
|
||||
InstantWithdraw bool
|
||||
TxHash ethCommon.Hash // Hash of the transaction that generated this event
|
||||
}
|
||||
|
||||
// RollupEvents is the list of events in a block of the Rollup Smart Contract
|
||||
@@ -577,6 +578,7 @@ func (c *RollupClient) RollupEventsByBlock(blockNum int64) (*RollupEvents, *ethC
|
||||
if instantWithdraw == 1 {
|
||||
withdraw.InstantWithdraw = true
|
||||
}
|
||||
withdraw.TxHash = vLog.TxHash
|
||||
rollupEvents.Withdraw = append(rollupEvents.Withdraw, withdraw)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ type WDelayerEventDeposit struct {
|
||||
Token ethCommon.Address
|
||||
Amount *big.Int
|
||||
DepositTimestamp uint64
|
||||
TxHash ethCommon.Hash // Hash of the transaction that generated this event
|
||||
}
|
||||
|
||||
// WDelayerEventWithdraw is an event of the WithdrawalDelayer Smart Contract
|
||||
@@ -411,6 +412,7 @@ func (c *WDelayerClient) WDelayerEventsByBlock(blockNum int64) (*WDelayerEvents,
|
||||
}
|
||||
deposit.Owner = ethCommon.BytesToAddress(vLog.Topics[1].Bytes())
|
||||
deposit.Token = ethCommon.BytesToAddress(vLog.Topics[2].Bytes())
|
||||
deposit.TxHash = vLog.TxHash
|
||||
wdelayerEvents.Deposit = append(wdelayerEvents.Deposit, deposit)
|
||||
|
||||
case logWDelayerWithdraw:
|
||||
|
||||
Reference in New Issue
Block a user