Skip to content

Commit

Permalink
Detect if transaction version is part of signature payload
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjan Zijderveld committed Jun 15, 2020
1 parent f886d46 commit da44e45
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ call = substrate.compose_call(
extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)

try:
result = substrate.send_extrinsic(extrinsic, wait_for_inclusion=True)
result = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
print("Extrinsic '{}' sent and included in block '{}'".format(result['extrinsic_hash'], result['block_hash']))

except SubstrateRequestException as e:
Expand Down
10 changes: 7 additions & 3 deletions substrateinterface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,16 +910,20 @@ def generate_signature_payload(self, call, era=None, nonce=0, tip=0, include_cal
else:
call_data = str(call.data)

signature_payload.encode({
payload_dict = {
'call': call_data,
'era': era,
'nonce': nonce,
'tip': tip,
'specVersion': self.runtime_version,
'transactionVersion': self.transaction_version,
'genesisHash': genesis_hash,
'blockHash': genesis_hash
})
}

if self.transaction_version:
payload_dict['transactionVersion'] = self.transaction_version

signature_payload.encode(payload_dict)

return signature_payload.data

Expand Down
43 changes: 43 additions & 0 deletions test/fixtures.py

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions test/test_runtime_state.py

Large diffs are not rendered by default.

0 comments on commit da44e45

Please sign in to comment.