Skip to content
This repository was archived by the owner on Jun 13, 2019. It is now read-only.
This repository was archived by the owner on Jun 13, 2019. It is now read-only.

Automatically add new block on sidechain when getting the deposit event #78

@ldmtam

Description

@ldmtam

Love your implementation, but I think we should automatically add new block on sidechain when getting the Deposit event from RootChain smart contract. We don't need sidechain admin to call submitBlock function by hand.

I've changed your code a little bit. Please review it

def apply_deposit(self, event):
        new_owner = utils.normalize_address(event['args']['depositor'])
        amount = event['args']['amount']
        uid = event['args']['uid']
        deposit_tx = Transaction(0, uid, amount, new_owner)
        self.current_block.add_tx(deposit_tx)
        self.db.save_block(self.current_block, self.current_block_number)
        self.current_block_number = self.db.increment_current_block_num()
        self.current_block = Block()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions