def test_EIP155_transaction_sender_extraction(txn_fixture): key = keys.PrivateKey(decode_hex(txn_fixture['key'])) transaction = rlp.decode(decode_hex(txn_fixture['signed']), sedes=SpuriousDragonTransaction) sender = extract_transaction_sender(transaction) assert is_same_address(sender, transaction.sender) assert is_same_address(sender, key.public_key.to_canonical_address())
def test_pre_EIP155_transaction_sender_extraction(transaction_class, txn_fixture): if txn_fixture['chainId'] is not None: pytest.skip("Only testng non-EIP155 transactions") key = keys.PrivateKey(decode_hex(txn_fixture['key'])) transaction = rlp.decode(decode_hex(txn_fixture['signed']), sedes=transaction_class) sender = extract_transaction_sender(transaction) assert is_same_address(sender, transaction.sender) assert is_same_address(sender, key.public_key.to_canonical_address())
def get_sender(self): return extract_transaction_sender(self)