mirror of https://github.com/poanetwork/quorum.git
fix raft block creating issue;
issue was that miner was subscribing to chainheadevent
This commit is contained in:
parent
f9541a4125
commit
30a2c8c7ef
|
@ -250,7 +250,7 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
|
|||
to = st.to()
|
||||
}
|
||||
//if input is empty for the smart contract call, return
|
||||
if len(data) == 0 {
|
||||
if len(data) == 0 && isPrivate {
|
||||
return nil, 0, false, nil
|
||||
}
|
||||
ret, st.gas, vmerr = evm.Call(sender, to, data, st.gas, st.value)
|
||||
|
|
|
@ -127,8 +127,6 @@ func (f *Feed) remove(sub *feedSub) {
|
|||
// Send delivers to all subscribed channels simultaneously.
|
||||
// It returns the number of subscribers that the value was sent to.
|
||||
func (f *Feed) Send(value interface{}) (nsent int) {
|
||||
rvalue := reflect.ValueOf(value)
|
||||
|
||||
f.once.Do(f.init)
|
||||
<-f.sendLock
|
||||
|
||||
|
@ -136,12 +134,13 @@ func (f *Feed) Send(value interface{}) (nsent int) {
|
|||
f.mu.Lock()
|
||||
f.sendCases = append(f.sendCases, f.inbox...)
|
||||
f.inbox = nil
|
||||
f.mu.Unlock()
|
||||
|
||||
rvalue := reflect.ValueOf(value)
|
||||
if !f.typecheck(rvalue.Type()) {
|
||||
f.sendLock <- struct{}{}
|
||||
panic(feedTypeError{op: "Send", got: rvalue.Type(), want: f.etype})
|
||||
}
|
||||
f.mu.Unlock()
|
||||
|
||||
// Set the sent value on all channels.
|
||||
for i := firstSubSendCase; i < len(f.sendCases); i++ {
|
||||
|
@ -230,19 +229,3 @@ func (cs caseList) deactivate(index int) caseList {
|
|||
cs[index], cs[last] = cs[last], cs[index]
|
||||
return cs[:last]
|
||||
}
|
||||
|
||||
// func (cs caseList) String() string {
|
||||
// s := "["
|
||||
// for i, cas := range cs {
|
||||
// if i != 0 {
|
||||
// s += ", "
|
||||
// }
|
||||
// switch cas.Dir {
|
||||
// case reflect.SelectSend:
|
||||
// s += fmt.Sprintf("%v<-", cas.Chan.Interface())
|
||||
// case reflect.SelectRecv:
|
||||
// s += fmt.Sprintf("<-%v", cas.Chan.Interface())
|
||||
// }
|
||||
// }
|
||||
// return s + "]"
|
||||
// }
|
||||
|
|
|
@ -153,15 +153,18 @@ func newWorker(config *params.ChainConfig, engine consensus.Engine, coinbase com
|
|||
agents: make(map[Agent]struct{}),
|
||||
unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth),
|
||||
}
|
||||
// Subscribe TxPreEvent for tx pool
|
||||
worker.txSub = eth.TxPool().SubscribeTxPreEvent(worker.txCh)
|
||||
// Subscribe events for blockchain
|
||||
worker.chainHeadSub = eth.BlockChain().SubscribeChainHeadEvent(worker.chainHeadCh)
|
||||
worker.chainSideSub = eth.BlockChain().SubscribeChainSideEvent(worker.chainSideCh)
|
||||
go worker.update()
|
||||
|
||||
go worker.wait()
|
||||
worker.commitNewWork()
|
||||
if _, ok := engine.(consensus.Istanbul); ok || !config.IsQuorum {
|
||||
// Subscribe TxPreEvent for tx pool
|
||||
worker.txSub = eth.TxPool().SubscribeTxPreEvent(worker.txCh)
|
||||
// Subscribe events for blockchain
|
||||
worker.chainHeadSub = eth.BlockChain().SubscribeChainHeadEvent(worker.chainHeadCh)
|
||||
worker.chainSideSub = eth.BlockChain().SubscribeChainSideEvent(worker.chainSideCh)
|
||||
go worker.update()
|
||||
|
||||
go worker.wait()
|
||||
worker.commitNewWork()
|
||||
}
|
||||
|
||||
return worker
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
defaultDialTimeout = 15 * time.Second
|
||||
defaultDialTimeout = 15 * time.Second
|
||||
refreshPeersInterval = 30 * time.Second
|
||||
staticPeerCheckInterval = 15 * time.Second
|
||||
|
||||
// Connectivity defaults.
|
||||
maxActiveDialTasks = 16
|
||||
|
@ -486,6 +488,9 @@ func (srv *Server) Start() (err error) {
|
|||
}
|
||||
|
||||
dynPeers := srv.maxDialedConns()
|
||||
if srv.NoDiscovery {
|
||||
dynPeers = 0
|
||||
}
|
||||
dialer := newDialState(srv.StaticNodes, srv.BootstrapNodes, srv.ntab, dynPeers, srv.NetRestrict)
|
||||
|
||||
// handshake
|
||||
|
|
Loading…
Reference in New Issue