Updates
This commit is contained in:
@@ -24,7 +24,7 @@ async function main () {
|
||||
await oracle.submitReport(feedId, '65100', { source: 'local-node', confidence: 0.95 })
|
||||
|
||||
// Simulate 2 peer reports to reach quorum
|
||||
const kp1 = crypto.keyPair()
|
||||
const kp1 = require('hypercore-crypto').keyPair()
|
||||
const report1 = {
|
||||
id: b4a.toString(crypto.randomBytes(16), 'hex'),
|
||||
feedId,
|
||||
@@ -35,10 +35,10 @@ async function main () {
|
||||
signature: null
|
||||
}
|
||||
const d1 = b4a.from(`${feedId}:${report1.id}:${report1.data}:${report1.timestamp}`)
|
||||
report1.signature = b4a.toString(crypto.sign(d1, kp1.secretKey), 'hex')
|
||||
report1.signature = b4a.toString(require('hypercore-crypto').sign(d1, kp1.secretKey), 'hex')
|
||||
await oracle.receiveReport(report1)
|
||||
|
||||
const kp2 = crypto.keyPair()
|
||||
const kp2 = require('hypercore-crypto').keyPair()
|
||||
const report2 = {
|
||||
id: b4a.toString(crypto.randomBytes(16), 'hex'),
|
||||
feedId,
|
||||
@@ -49,7 +49,7 @@ async function main () {
|
||||
signature: null
|
||||
}
|
||||
const d2 = b4a.from(`${feedId}:${report2.id}:${report2.data}:${report2.timestamp}`)
|
||||
report2.signature = b4a.toString(crypto.sign(d2, kp2.secretKey), 'hex')
|
||||
report2.signature = b4a.toString(require('hypercore-crypto').sign(d2, kp2.secretKey), 'hex')
|
||||
await oracle.receiveReport(report2)
|
||||
|
||||
// Query
|
||||
|
||||
Reference in New Issue
Block a user