mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
- 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.
38 lines
1.4 KiB
Go
38 lines
1.4 KiB
Go
package common
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
ethCommon "github.com/ethereum/go-ethereum/common"
|
|
"github.com/iden3/go-merkletree"
|
|
)
|
|
|
|
// ExitInfo represents the ExitTree Leaf data
|
|
type ExitInfo struct {
|
|
BatchNum BatchNum `meddler:"batch_num"`
|
|
AccountIdx Idx `meddler:"account_idx"`
|
|
MerkleProof *merkletree.CircomVerifierProof `meddler:"merkle_proof,json"`
|
|
Balance *big.Int `meddler:"balance,bigint"`
|
|
// InstantWithdrawn is the ethBlockNum in which the exit is withdrawn
|
|
// instantly. nil means this hasn't happened.
|
|
InstantWithdrawn *int64 `meddler:"instant_withdrawn"`
|
|
// DelayedWithdrawRequest is the ethBlockNum in which the exit is
|
|
// requested to be withdrawn from the delayedWithdrawn smart contract.
|
|
// nil means this hasn't happened.
|
|
DelayedWithdrawRequest *int64 `meddler:"delayed_withdraw_request"`
|
|
// DelayedWithdrawn is the ethBlockNum in which the exit is withdrawn
|
|
// from the delayedWithdrawn smart contract. nil means this hasn't
|
|
// happened.
|
|
DelayedWithdrawn *int64 `meddler:"delayed_withdrawn"`
|
|
}
|
|
|
|
// WithdrawInfo represents a withdraw action to the rollup
|
|
type WithdrawInfo struct {
|
|
Idx Idx
|
|
NumExitRoot BatchNum
|
|
InstantWithdraw bool
|
|
TxHash ethCommon.Hash // hash of the transaction in which the withdraw happened
|
|
Owner ethCommon.Address
|
|
Token ethCommon.Address
|
|
}
|