mirror of https://github.com/poanetwork/gecko.git
Merge pull request #171 from StephenButtolph/atomic-block-cleanup
Clean up the acceptance of atomic blocks
This commit is contained in:
commit
c3f9a50228
|
@ -36,7 +36,7 @@ type AtomicTx interface {
|
||||||
// AtomicBlock being accepted results in the transaction contained in the
|
// AtomicBlock being accepted results in the transaction contained in the
|
||||||
// block to be accepted and committed to the chain.
|
// block to be accepted and committed to the chain.
|
||||||
type AtomicBlock struct {
|
type AtomicBlock struct {
|
||||||
SingleDecisionBlock `serialize:"true"`
|
CommonDecisionBlock `serialize:"true"`
|
||||||
|
|
||||||
Tx AtomicTx `serialize:"true"`
|
Tx AtomicTx `serialize:"true"`
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ type AtomicBlock struct {
|
||||||
|
|
||||||
// initialize this block
|
// initialize this block
|
||||||
func (ab *AtomicBlock) initialize(vm *VM, bytes []byte) error {
|
func (ab *AtomicBlock) initialize(vm *VM, bytes []byte) error {
|
||||||
if err := ab.SingleDecisionBlock.initialize(vm, bytes); err != nil {
|
if err := ab.CommonDecisionBlock.initialize(vm, bytes); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return ab.Tx.initialize(vm)
|
return ab.Tx.initialize(vm)
|
||||||
|
@ -123,9 +123,6 @@ func (ab *AtomicBlock) Accept() {
|
||||||
ab.onAcceptFunc()
|
ab.onAcceptFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
parent := ab.parentBlock()
|
|
||||||
// remove this block and its parent from memory
|
|
||||||
parent.free()
|
|
||||||
ab.free()
|
ab.free()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,11 +130,9 @@ func (ab *AtomicBlock) Accept() {
|
||||||
// decision block, has ID [parentID].
|
// decision block, has ID [parentID].
|
||||||
func (vm *VM) newAtomicBlock(parentID ids.ID, tx AtomicTx) (*AtomicBlock, error) {
|
func (vm *VM) newAtomicBlock(parentID ids.ID, tx AtomicTx) (*AtomicBlock, error) {
|
||||||
ab := &AtomicBlock{
|
ab := &AtomicBlock{
|
||||||
SingleDecisionBlock: SingleDecisionBlock{CommonDecisionBlock: CommonDecisionBlock{
|
CommonDecisionBlock: CommonDecisionBlock{CommonBlock: CommonBlock{
|
||||||
CommonBlock: CommonBlock{
|
|
||||||
Block: core.NewBlock(parentID),
|
Block: core.NewBlock(parentID),
|
||||||
vm: vm,
|
vm: vm,
|
||||||
},
|
|
||||||
}},
|
}},
|
||||||
Tx: tx,
|
Tx: tx,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue