Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

able to inject hrmp via dev_newBlock #132

Merged
merged 1 commit into from
Jan 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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