Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6626 from conr2d/code_hash
Browse files Browse the repository at this point in the history
Return code_version instead of recalculating code hash
  • Loading branch information
b1bart authored Jan 17, 2019
2 parents 6f12742 + 426f044 commit affc199
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,7 @@ read_only::get_code_results read_only::get_code( const get_code_params& params )

if( accnt.code.size() ) {
result.wasm = string(accnt.code.begin(), accnt.code.end());
result.code_hash = fc::sha256::hash( accnt.code.data(), accnt.code.size() );
result.code_hash = accnt.code_version;
}

abi_def abi;
Expand All @@ -1650,7 +1650,7 @@ read_only::get_code_hash_results read_only::get_code_hash( const get_code_hash_p
const auto& accnt = d.get<account_object,by_name>( params.account_name );

if( accnt.code.size() ) {
result.code_hash = fc::sha256::hash( accnt.code.data(), accnt.code.size() );
result.code_hash = accnt.code_version;
}

return result;
Expand All @@ -1675,7 +1675,7 @@ read_only::get_raw_abi_results read_only::get_raw_abi( const get_raw_abi_params&
const auto& d = db.db();
const auto& accnt = d.get<account_object,by_name>(params.account_name);
result.abi_hash = fc::sha256::hash( accnt.abi.data(), accnt.abi.size() );
result.code_hash = fc::sha256::hash( accnt.code.data(), accnt.code.size() );
result.code_hash = accnt.code_version;
if( !params.abi_hash || *params.abi_hash != result.abi_hash )
result.abi = blob{{accnt.abi.begin(), accnt.abi.end()}};

Expand Down

0 comments on commit affc199

Please sign in to comment.