Skip to content

Commit 39c57aa

Browse files
author
Nova
committed
修复了几个bug
1 parent c60e0e2 commit 39c57aa

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

modules/Block/Block.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ MOM.verifyActionList = async function () {
150150
for (let count = 0; count < 4; count++) {
151151
var missAction = await wo.Peer.call('/Action/getAction', { Action: { hash: actionHash } })
152152
if (missAction) {
153-
if (wo[missAction.type].validater(missAction)) {
153+
if (wo[missAction.type].validate(missAction)) {
154154
await wo[missAction.type].execute(missAction) // 执行该Action
155155
await wo[missAction.type].addOne({ [missAction.type]: missAction }) // 加入Action表
156156
}

modules/Consensus/pot.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,12 @@ POT.mineOnce = async function () {
329329
my.currentPhase = 'mining'
330330
mylog.info('<====== 出块阶段 ======>')
331331
let canMine = Date.time2height() === (await wo.Chain.getTopBlock()).height + 1
332-
mylog.info(`可否出块: ${canMine}`)
332+
mylog.info(`是否在正常出块阶段: ${canMine}`)
333333
if (canMine) {
334334
mylog.info(new Date() + ':出块阶段开始 for block=' + ((await wo.Chain.getTopBlock()).height + 1) + ' using block=' + (await wo.Chain.getTopBlock()).height)
335335
mylog.info('本节点的候选签名=' + my.selfPot.signature + ',来自地址地址 ' + wo.Crypto.pubkey2address(my.selfPot.pubkey))
336336
mylog.info('全网最终获胜签名=' + my.bestPot.signature + ',来自地址地址 ' + wo.Crypto.pubkey2address(my.bestPot.pubkey))
337-
if (my.selfPot.signature && my.bestPot.signature === my.selfPot.signature) { // 全网最终获胜者是我自己,于是打包并广播。注意防止 bestPot===selfPot===undefined,这是跳过竞选阶段直接从前两阶段开始会发生的。
337+
if (my.selfPot.signature && my.selfPot.pubkey && my.selfPot.signature === my.bestPot.signature && my.selfPot.pubkey === my.bestPot.pubkey) { // 全网最终获胜者是我自己,于是打包并广播。注意防止 bestPot===selfPot===undefined,这是跳过竞选阶段直接从前两阶段开始会发生的。
338338
mylog.info('本节点获胜,开始出块...')
339339
let newBlock = await wo.Chain.createBlock({
340340
winnerMessage: my.selfPot.message,

modules/peer/SocCluster.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,12 @@ SocCluster.prototype.addEventHandler = function (socket) {
368368
if (!message || message.ttl <= 0 || message.ttl > MSG_TTL || !message.data) { return 0 }
369369
try {
370370
message.data = JSON.parse(message.data)
371+
if (socket.broadcast && socket.broadcast.emit) {
372+
socket.broadcast.emit('broadcast', message) // 继续向发信人以外广播
373+
}
371374
} finally {
372375
this.emit('broadcast', message.data)
373376
if (wo.EventBus) wo.EventBus.crosEmit('Peer', 'broadcast', message.data)
374-
socket.broadcast.emit('broadcast', message) // 继续向发信人以外广播
375377
}
376378
})
377379
socket.on('disconnect', () => {

0 commit comments

Comments
 (0)