Skip to content

Commit

Permalink
Merge pull request #11 from qtumproject/earlz/optimize-deleteaddresses
Browse files Browse the repository at this point in the history
Change std::vector to std::set for deleteAddresses
  • Loading branch information
qtum-neil authored Jun 25, 2017
2 parents 9393009 + 6f05e8c commit 1a8e6a4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libethcore/SealEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class SealEngineFace
virtual bigint costOfPrecompiled(Address const& _a, bytesConstRef _in, u256 const&) const { return m_params.precompiled.at(_a).cost(_in); }
virtual std::pair<bool, bytes> executePrecompiled(Address const& _a, bytesConstRef _in, u256 const&) const { return m_params.precompiled.at(_a).execute(_in); }

mutable std::vector<Address> deleteAddresses; // qtum
mutable std::set<Address> deleteAddresses; // qtum

protected:
virtual bool onOptionChanging(std::string const&, bytes const&) { return true; }
Expand Down
2 changes: 1 addition & 1 deletion libethereum/Executive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ bool Executive::call(CallParameters const& _p, u256 const& _gasPrice, Address co

//////////////////////////////////////////////// // qtum
if(!m_s.addressInUse(_p.receiveAddress))
m_sealEngine.deleteAddresses.push_back(_p.receiveAddress);
m_sealEngine.deleteAddresses.insert(_p.receiveAddress);
////////////////////////////////////////////////

// Transfer ether.
Expand Down
2 changes: 1 addition & 1 deletion libethereum/ExtVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void ExtVM::suicide(Address _a)
// m_s.addBalance(_a, m_s.balance(myAddress));
// m_s.subBalance(myAddress, m_s.balance(myAddress));
if(!m_s.addressInUse(_a)){
m_sealEngine.deleteAddresses.push_back(_a);
m_sealEngine.deleteAddresses.insert(_a);
}
m_s.transferBalance(myAddress, _a, m_s.balance(myAddress));
ExtVMFace::suicide(_a);
Expand Down

0 comments on commit 1a8e6a4

Please sign in to comment.