aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <tederminant@gmail.com>2020-08-19 11:45:32 -0400
committerDeterminant <tederminant@gmail.com>2020-08-19 11:45:32 -0400
commitfbcfc73c7a92d0a2615ef90c4dffa4746161b9c7 (patch)
treeac48018d47ce71ab9f07668ebe21f3c54b6f5dd4
parent315ad2c63fa4879e5a91c3aa013c93f8f4969362 (diff)
...
-rw-r--r--plugin/evm/block.go6
-rw-r--r--plugin/evm/vm.go7
2 files changed, 10 insertions, 3 deletions
diff --git a/plugin/evm/block.go b/plugin/evm/block.go
index 45a888f..a2ffb69 100644
--- a/plugin/evm/block.go
+++ b/plugin/evm/block.go
@@ -80,12 +80,12 @@ func (b *Block) Verify() error {
p = p.Parent().(*Block)
}
for i := len(path) - 1; i >= 0; i-- {
- inputs_copy := new(ids.Set)
+ inputsCopy := new(ids.Set)
p := path[i]
atx := vm.getAtomicTx(p.ethBlock)
inputs.Union(atx.UnsignedTx.(UnsignedAtomicTx).InputUTXOs())
- inputs_copy.Union(*inputs)
- vm.blockAtomicInputCache.Put(p.ID(), inputs_copy)
+ inputsCopy.Union(*inputs)
+ vm.blockAtomicInputCache.Put(p.ID(), inputsCopy)
}
tx := b.vm.getAtomicTx(b.ethBlock)
atx := tx.UnsignedTx.(*UnsignedImportTx)
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index 7a310bf..b72ac49 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -173,6 +173,8 @@ func (vm *VM) Initialize(
}
vm.ctx = ctx
+ vm.avaxAssetID = ctx.AVAXAssetID
+ vm.avm = ctx.XChainID
vm.chaindb = Database{db}
g := new(core.Genesis)
err := json.Unmarshal(b, g)
@@ -237,6 +239,11 @@ func (vm *VM) Initialize(
chain.SetOnExtraStateChange(func(block *types.Block, statedb *state.StateDB) error {
atx := vm.getAtomicTx(block).UnsignedTx.(*UnsignedImportTx)
vm.ctx.Log.Info(atx.ID().String())
+ for _, to := range atx.Outs {
+ amount := new(big.Int)
+ amount.SetUint64(to.Amount)
+ statedb.AddBalance(to.Address, amount)
+ }
return nil
})
vm.blockCache = cache.LRU{Size: 2048}