Skip to content

Commit

Permalink
Merge pull request #15 from DeathRay1977/master
Browse files Browse the repository at this point in the history
Perfect, thanks!
  • Loading branch information
darkcoinproject committed Jul 1, 2014
2 parents 97cac8b + b776437 commit 212015e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5840,12 +5840,15 @@ class CMainCleanup
*/


void CDarkSendPool::SetCollateralAddress(std::string strAddress){
bool CDarkSendPool::SetCollateralAddress(std::string strAddress){
CBitcoinAddress address;
if (!address.SetString(strAddress))
{
printf("CDarkSendPool::SetCollateralAddress - Invalid DarkSend collateral address\n");

return false;
}
collateralPubKey.SetDestination(address.Get());
return true;
}

//Get last block hash
Expand Down
2 changes: 1 addition & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -2516,7 +2516,7 @@ class CDarkSendPool
SetCollateralAddress(strAddress);
}

void SetCollateralAddress(std::string strAddress);
bool SetCollateralAddress(std::string strAddress);
bool GetLastValidBlockHash(uint256& hash, int mod=10);
int GetCurrentMasterNode(int mod=10);
void NewBlock();
Expand Down
30 changes: 30 additions & 0 deletions src/test/darksend_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,36 @@ BOOST_AUTO_TEST_CASE(darksend_sign)

}

BOOST_AUTO_TEST_CASE(set_collateral_address_bad)
{
CDarkSendPool * dsp_ptr = new CDarkSendPool();

string crappy = "badaddress";

BOOST_CHECK( dsp_ptr->SetCollateralAddress(crappy) == false );
delete dsp_ptr;
}

BOOST_AUTO_TEST_CASE(set_collateral_address_production)
{
CDarkSendPool * dsp_ptr = new CDarkSendPool();

string prod = "Xq19GqFvajRrEdDHYRKGYjTsQfpV5jyipF";

BOOST_CHECK( dsp_ptr->SetCollateralAddress(prod) == true );
delete dsp_ptr;
}

BOOST_AUTO_TEST_CASE(set_collateral_address_testnet)
{
CDarkSendPool * dsp_ptr = new CDarkSendPool();

string testnet = "mxE2Rp3oYpSEFdsN5TdHWhZvEHm3PJQQVm";

BOOST_CHECK( dsp_ptr->SetCollateralAddress(testnet) == true );
delete dsp_ptr;
}


BOOST_AUTO_TEST_CASE(darksend_vote)
{
Expand Down

0 comments on commit 212015e

Please sign in to comment.