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
|
||||
}
|
||||
|
||||
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 {
|
||||
logrus.Errorf("Failed to submit on-chain result: %v", err)
|
||||
}
|
||||
@ -180,11 +180,13 @@ func (pcm *PBFTConsensusManager) handleCommit(message *types.Message) {
|
||||
}
|
||||
|
||||
func (pcm *PBFTConsensusManager) createConsensusInfo(task *types2.DioneTask, isLeader bool) {
|
||||
if _, ok := pcm.consensusMap[task.ConsensusID]; !ok {
|
||||
pcm.consensusMap[task.ConsensusID] = &Consensus{
|
||||
IsCurrentMinerLeader: isLeader,
|
||||
Task: task,
|
||||
Finished: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (pcm *PBFTConsensusManager) GetConsensusInfo(consensusID string) *Consensus {
|
||||
|
@ -137,6 +137,10 @@ func (m *Miner) MineTask(ctx context.Context, event *dioneOracle.DioneOracleNewO
|
||||
OriginChain: event.OriginChain,
|
||||
RequestType: event.RequestType,
|
||||
RequestParams: event.RequestParams,
|
||||
RequestID: event.ReqID.String(),
|
||||
ConsensusID: event.ReqID.String(),
|
||||
CallbackAddress: event.CallbackAddress.Bytes(),
|
||||
CallbackMethodID: event.CallbackMethodID[:],
|
||||
Miner: m.address,
|
||||
MinerEth: m.ethAddress.Hex(),
|
||||
Ticket: ticket,
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
|
@ -184,8 +184,8 @@ func (c *EthereumClient) SubscribeOnOracleEvents(ctx context.Context) (chan *dio
|
||||
return resChan, subscription, err
|
||||
}
|
||||
|
||||
func (c *EthereumClient) SubmitRequestAnswer(reqID *big.Int, callbackAddress common.Address, requestParams string, requestDeadline *big.Int, data []byte) error {
|
||||
_, err := c.dioneOracle.SubmitOracleRequest(requestParams, callbackAddress, [4]byte{}, reqID, requestDeadline, data)
|
||||
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, callbackMethodID, reqID, requestDeadline, data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -307,6 +307,7 @@ func (n *Node) setupRPCClients() error {
|
||||
fc := filecoin.NewLotusClient()
|
||||
rpc.RegisterRPC(rtypes.RPCTypeFilecoin, map[string]func(string) ([]byte, error){
|
||||
"getTransaction": fc.GetTransaction,
|
||||
"getBlock": fc.GetBlock,
|
||||
})
|
||||
|
||||
sl := solana2.NewSolanaClient()
|
||||
|
Loading…
Reference in New Issue
Block a user