[fix] fixed net_peerCount

@types
neeboo 6 years ago
parent 95374015b6
commit e41bfe843c
  1. 4
      examples/testNode.js
  2. 24
      packages/harmony-core/src/blockchain.ts

@ -35,7 +35,9 @@ server.listen(port, function(err, blockchain) {
acc.signTransaction(txn, true).then((signed) => {
// console.log(signed.txPayload);
harmony.
harmony.blockchain.sendRawTransaction(signed).then((res) => {
console.log(res);
});
});
// console.log(harmony.messenger.setRPCPrefix('eth_getPPP'));

@ -239,11 +239,7 @@ class Blockchain extends HarmonyCore {
}
async net_peerCount() {
const result = await this.messenger.send(
RPCMethod.PeerCount,
[],
this.chainPrefix,
);
const result = await this.messenger.send(RPCMethod.PeerCount, [], 'net');
return result;
}
@ -306,15 +302,15 @@ class Blockchain extends HarmonyCore {
return result;
}
// async sendRawTransaction(transaction: Transaction) {
// if (!transaction.isSigned || !transaction) {
// throw new Error('transaction is not signed or not exist');
// }
// const [txn, result] = await transaction.sendTransaction();
// if (txn.isPending) {
// return result;
// }
// }
async sendRawTransaction(transaction: Transaction) {
if (!transaction.isSigned || !transaction) {
throw new Error('transaction is not signed or not exist');
}
const [txn, result] = await transaction.sendTransaction();
if (txn.isPending) {
return result;
}
}
}
export { Blockchain };

Loading…
Cancel
Save