aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-19 14:36:36 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commit78dac82d810fe4a1ad6878adbc789f909155f472 (patch)
tree13189c293ed8603a7e9d8b15571fff1737c9bc1f /core/blockchain.go
parent8a0b917def2d80b112d7d8a5854aba62afc0a630 (diff)
downloadgo-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.tar.gz
go-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.tar.zst
go-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.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.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index a67e2a13f..983448de8 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -1714,7 +1714,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()
@@ -1729,7 +1729,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)