Fix some consensus code which was broken by refactoring
This commit is contained in:
parent
9fcd925dcb
commit
1b5f9a0d30
@ -169,7 +169,7 @@ func (pcm *PBFTConsensusManager) handleCommit(message *types.Message) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = pcm.ethereumClient.SubmitRequestAnswer(reqID, callbackAddress, request.RequestParams, request.Deadline, consensusMsg.Task.Payload)
|
err = pcm.ethereumClient.SubmitRequestAnswer(reqID, callbackAddress, request.CallbackMethodID, request.RequestParams, request.Deadline, consensusMsg.Task.Payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("Failed to submit on-chain result: %v", err)
|
logrus.Errorf("Failed to submit on-chain result: %v", err)
|
||||||
}
|
}
|
||||||
@ -180,10 +180,12 @@ func (pcm *PBFTConsensusManager) handleCommit(message *types.Message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (pcm *PBFTConsensusManager) createConsensusInfo(task *types2.DioneTask, isLeader bool) {
|
func (pcm *PBFTConsensusManager) createConsensusInfo(task *types2.DioneTask, isLeader bool) {
|
||||||
pcm.consensusMap[task.ConsensusID] = &Consensus{
|
if _, ok := pcm.consensusMap[task.ConsensusID]; !ok {
|
||||||
IsCurrentMinerLeader: isLeader,
|
pcm.consensusMap[task.ConsensusID] = &Consensus{
|
||||||
Task: task,
|
IsCurrentMinerLeader: isLeader,
|
||||||
Finished: false,
|
Task: task,
|
||||||
|
Finished: false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,16 +134,20 @@ func (m *Miner) MineTask(ctx context.Context, event *dioneOracle.DioneOracleNewO
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &types.DioneTask{
|
return &types.DioneTask{
|
||||||
OriginChain: event.OriginChain,
|
OriginChain: event.OriginChain,
|
||||||
RequestType: event.RequestType,
|
RequestType: event.RequestType,
|
||||||
RequestParams: event.RequestParams,
|
RequestParams: event.RequestParams,
|
||||||
Miner: m.address,
|
RequestID: event.ReqID.String(),
|
||||||
MinerEth: m.ethAddress.Hex(),
|
ConsensusID: event.ReqID.String(),
|
||||||
Ticket: ticket,
|
CallbackAddress: event.CallbackAddress.Bytes(),
|
||||||
ElectionProof: winner,
|
CallbackMethodID: event.CallbackMethodID[:],
|
||||||
BeaconEntries: beaconValues,
|
Miner: m.address,
|
||||||
Payload: res,
|
MinerEth: m.ethAddress.Hex(),
|
||||||
DrandRound: types.DrandRound(randomBase.Round),
|
Ticket: ticket,
|
||||||
|
ElectionProof: winner,
|
||||||
|
BeaconEntries: beaconValues,
|
||||||
|
Payload: res,
|
||||||
|
DrandRound: types.DrandRound(randomBase.Round),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func verifyTaskSignature(msg types.ConsensusMessage) error {
|
func verifyTaskSignature(msg types.ConsensusMessage) error {
|
||||||
cHash, err := hashstructure.Hash(msg, hashstructure.FormatV2, nil)
|
cHash, err := hashstructure.Hash(msg.Task, hashstructure.FormatV2, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -184,8 +184,8 @@ func (c *EthereumClient) SubscribeOnOracleEvents(ctx context.Context) (chan *dio
|
|||||||
return resChan, subscription, err
|
return resChan, subscription, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *EthereumClient) SubmitRequestAnswer(reqID *big.Int, callbackAddress common.Address, requestParams string, requestDeadline *big.Int, data []byte) error {
|
func (c *EthereumClient) SubmitRequestAnswer(reqID *big.Int, callbackAddress common.Address, callbackMethodID [4]byte, requestParams string, requestDeadline *big.Int, data []byte) error {
|
||||||
_, err := c.dioneOracle.SubmitOracleRequest(requestParams, callbackAddress, [4]byte{}, reqID, requestDeadline, data)
|
_, err := c.dioneOracle.SubmitOracleRequest(requestParams, callbackAddress, callbackMethodID, reqID, requestDeadline, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -307,6 +307,7 @@ func (n *Node) setupRPCClients() error {
|
|||||||
fc := filecoin.NewLotusClient()
|
fc := filecoin.NewLotusClient()
|
||||||
rpc.RegisterRPC(rtypes.RPCTypeFilecoin, map[string]func(string) ([]byte, error){
|
rpc.RegisterRPC(rtypes.RPCTypeFilecoin, map[string]func(string) ([]byte, error){
|
||||||
"getTransaction": fc.GetTransaction,
|
"getTransaction": fc.GetTransaction,
|
||||||
|
"getBlock": fc.GetBlock,
|
||||||
})
|
})
|
||||||
|
|
||||||
sl := solana2.NewSolanaClient()
|
sl := solana2.NewSolanaClient()
|
||||||
|
Loading…
Reference in New Issue
Block a user