Skip to content

Commit

Permalink
fix L1 transaction env
Browse files Browse the repository at this point in the history
  • Loading branch information
Geo25rey committed Apr 12, 2024
1 parent 3763874 commit 348576b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/services/new/contractEngineV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,14 @@ class VmContext {

console.log(tx)

const blockHeader = await this.engine.self.chainBridge.blockHeaders.findOne({
const blockHeader = await this.engine.self.chainBridge.blockHeaders.findOne(tx.anchored_id ? {
id: tx.anchored_id
} : {
slot_height: {$lte: tx.anchored_height}
}, tx.anchored_id ? {} : {
sort: {
slot_height: -1
}
})
const requiredAuths = tx.required_auths.map(e => typeof e === 'string' ? e : e.value).map(e => {
if(tx.src === 'hive') {
Expand All @@ -94,9 +100,9 @@ class VmContext {
action: tx.data.action,
payload: JSON.stringify(tx.data.payload),
env: {
'anchor.id': tx.anchored_id,
'anchor.id': blockHeader.id,
'anchor.height': tx.anchored_height,
'anchor.block': tx.anchored_block,
'anchor.block': tx.anchored_block || `hive:${tx.id}`,
'anchor.timestamp': blockHeader.ts.getTime(),


Expand Down

0 comments on commit 348576b

Please sign in to comment.