mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
add validation
This commit is contained in:
parent
2b8d317518
commit
afa694e566
1 changed files with 8 additions and 2 deletions
|
|
@ -51,12 +51,18 @@ func newFreezerBatch(f *Freezer) *freezerBatch {
|
||||||
|
|
||||||
// Append adds an RLP-encoded item of the given kind.
|
// Append adds an RLP-encoded item of the given kind.
|
||||||
func (batch *freezerBatch) Append(kind string, num uint64, item interface{}) error {
|
func (batch *freezerBatch) Append(kind string, num uint64, item interface{}) error {
|
||||||
return batch.tables[kind].Append(num, item)
|
if table := batch.tables[kind]; table != nil {
|
||||||
|
return table.Append(num, item)
|
||||||
|
}
|
||||||
|
return errUnknownTable
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppendRaw adds an item of the given kind.
|
// AppendRaw adds an item of the given kind.
|
||||||
func (batch *freezerBatch) AppendRaw(kind string, num uint64, item []byte) error {
|
func (batch *freezerBatch) AppendRaw(kind string, num uint64, item []byte) error {
|
||||||
return batch.tables[kind].AppendRaw(num, item)
|
if table := batch.tables[kind]; table != nil {
|
||||||
|
return table.AppendRaw(num, item)
|
||||||
|
}
|
||||||
|
return errUnknownTable
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset initializes the batch.
|
// reset initializes the batch.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue