Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Asset Tx Chaining #237

Merged
merged 13 commits into from
Aug 20, 2018
Merged

Allow Asset Tx Chaining #237

merged 13 commits into from
Aug 20, 2018

Conversation

blondfrogs
Copy link
Contributor

This PR allows the following to be done with assets before a block is mined.
issue CHAIN 100 , issue CHAIN/A 100, issue CHAIN/B 100
issue CHAIN/A/A ,issue CHAIN/A/A/C
You can also chain reissues of a asset once it is issued in a block
Block Mined that contains the above issues
reissue CHAIN 100 "address", reissue CHAIN 200 "address" two or more reissues are valid to the chain

Enforce all asset transaction OutPoints to contain 0 RVN in them. This will make it so the network wont allow tx's to accidentally spend there assets when spending RVN to an address.

Updated AvailableCoins function to return only asset tx's or rvn tx's depending on flags passed to function. This fixes the asset outpoints showing up in the Send Dialog Coincontrol. Only RVN tx's show up in the Send Dialog Coincontrol box.

Copy link
Contributor

@cfox cfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😳


if (mapAssetsAddressAmount[make_pair(assetName, address)] == 0 &&
if (mapAssetsAddressAmount.at(pair) < 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should never happen right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can happen, only with chained transactions. It occurs when blocks are being undone because of a chain split

if (!totalInputs.count(outValue.first)) {
std::string errorMsg;
errorMsg = strprintf("Bad Transaction - Trying to create outpoint for asset that you don't have: %s", outValue.first);
return state.DoS(100, false, REJECT_INVALID, "bad-tx-inputs-outputs-mismatch " + errorMsg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy/pasted error code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return statements are the same yes, but they return different messages.

const CAmount &nMaximumAmount, const CAmount &nMinimumSumAmount,
const uint64_t &nMaximumCount, const int &nMinDepth, const int &nMaxDepth) const
{
if (!AreAssetsDeployed())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this still return RVN coins instead of bailing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with better code. This is a copy paste mistake

}


// setCoinsRet.insert(CInputCoin(out.tx, out.i));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented section still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the commented out code

Copy link
Contributor

@cfox cfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛓⛓⛓

@blondfrogs blondfrogs merged commit 9843103 into develop2 Aug 20, 2018
@blondfrogs blondfrogs deleted the asset-tx-chaining branch September 21, 2018 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants