Skip to content

Commit

Permalink
able to inject hrmp via dev_newBlock (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc authored Jan 10, 2023
1 parent 991c6ce commit e9245c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rpc/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const logger = defaultLogger.child({ name: 'rpc-dev' })

const handlers: Handlers = {
dev_newBlock: async (context, [param]) => {
const { count, to } = param || {}
const { count, to, hrmp } = param || {}
const now = context.chain.head.number
const diff = to ? to - now : count
const finalCount = diff > 0 ? diff : 1

let finalHash: string | undefined

for (let i = 0; i < finalCount; i++) {
const block = await context.chain.newBlock().catch((error) => {
const block = await context.chain.newBlock({ inherent: { horizontalMessages: hrmp } }).catch((error) => {
throw new ResponseError(1, error.toString())
})
logger.debug({ hash: block.hash }, 'dev_newBlock')
Expand Down

0 comments on commit e9245c1

Please sign in to comment.