Skip to content

Commit

Permalink
Merge pull request #922 from eth-brownie/feat-tx-replace
Browse files Browse the repository at this point in the history
Replace transactions broadcast outside of brownie
  • Loading branch information
iamdefinitelyahuman committed Jan 6, 2021
2 parents 0a08efc + 3c80ed4 commit 50aa56e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion brownie/network/transaction.py
Expand Up @@ -324,7 +324,18 @@ def replace(
if silent is None:
silent = self._silent

return self.sender.transfer( # type: ignore
sender = self.sender
if isinstance(sender, EthAddress):
# if the transaction wasn't broadcast during this brownie session,
# check if the sender is unlocked - we might be able to replace anyway
from brownie import accounts

if sender in accounts:
sender = accounts.at(sender)
else:
raise ValueError("Sender address not in `accounts`")

return sender.transfer( # type: ignore
self.receiver,
self.value,
gas_limit=self.gas_limit,
Expand Down

0 comments on commit 50aa56e

Please sign in to comment.