diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-19 14:36:36 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2018-12-19 20:54:27 +0800 |
commit | 3314c0573822d5008211e076831258899565ba5d (patch) | |
tree | 5d5b97b513ef52746b4584b21f4efb636aba5106 /core/blockchain.go | |
parent | d41f3b1a9834e7911603b3ec3ddf0714d99ceca9 (diff) | |
download | dexon-3314c0573822d5008211e076831258899565ba5d.tar dexon-3314c0573822d5008211e076831258899565ba5d.tar.gz dexon-3314c0573822d5008211e076831258899565ba5d.tar.bz2 dexon-3314c0573822d5008211e076831258899565ba5d.tar.lz dexon-3314c0573822d5008211e076831258899565ba5d.tar.xz dexon-3314c0573822d5008211e076831258899565ba5d.tar.zst dexon-3314c0573822d5008211e076831258899565ba5d.zip |
governance: implement delegate/undelegate function and add tests (#33)
Implement delegate/undelegate function to allow others to delegate it's
fund to stake on a node. Also added governance contract tests.
Diffstat (limited to 'core/blockchain.go')
-rw-r--r-- | core/blockchain.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index b6d85b7d7..eec1a6879 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1708,7 +1708,7 @@ func (bc *BlockChain) GetPendingHeight() uint64 { return bc.lastPendingHeight } -func (bc *BlockChain) GetPendingBlock() *types.Block { +func (bc *BlockChain) PendingBlock() *types.Block { bc.pendingBlockMu.RLock() defer bc.pendingBlockMu.RUnlock() @@ -1723,7 +1723,10 @@ func (bc *BlockChain) GetPendingBlockByNumber(number uint64) *types.Block { } func (bc *BlockChain) GetPending() (*types.Block, *state.StateDB) { - block := bc.GetPendingBlock() + block := bc.PendingBlock() + if block == nil { + block = bc.CurrentBlock() + } s, err := state.New(block.Header().Root, bc.stateCache) if err != nil { panic(err) |