Comments (5)
Now I get it.
This part of the code:
pcoin.first->GetHash() != txNew.vin[0].prevout.hash
prevents two outputs from the same transaction from being merged together.
The intention of the code is probably to prevent adding in the output that is being staked. If we check the output index number as well as the transaction hash, this will be fixed.
from clams.
Fixed in #22.
from clams.
I am sure I am mistaken, but it looks a bit like this line of code was specifically designed to prevent what you are enabling..?
Under what circumstances would it be desirable to recombine outputs belonging to the same hash?
When would two outputs, from the same transaction, appear?
- The Client previously decided to 'split' the output.
- A user purposefully splits outputs directing them to the same address in the same tx (I believe this may be checked against).
Reasons NOT to recombine outputs with the same hash:
- If the client split them in a previous stake (and our split code is fixed to work properly), presumably there was a reason and the intention is to keep them split.
- If a user split them on purpose, recombining them is counter-productive, as well.
from clams.
You may be right as to the original intention of the code. It's impossible to tell in the absence of comments or other design documentation whether that line is doing what was intended or not.
My guess was that the intent of the code was to check whether the current iteration through the loop is looking at the output which just staked, and if so, to ignore it, which is what my modification makes it do. I could be wrong with my guess.
If the client split them in a previous stake (and our split code is fixed to work properly), presumably there was a reason and the intention is to keep them split.
I'm thinking the client split them because they were staking too fast. Later on, as the difficulty increases, maybe they start staking too slowly, and so need recombining.
Consider the case where I have two outputs (A and B) of 6 CLAMs each, at the same address.
A gets split into Ax and Ay. B gets split into Bx and By.
Ax, Ay, Bx, By are all 3 CLAMs each, all at the same address.
Ax can combine with Bx or By but not with Ay.
Where's the sense in that?
Given the current code, Ax will combine with Bx and By, making Cx (9 CLAMs), and the next time it stakes, Cx will combine with Ay, making a single 12 CLAM output. So the end result is the same, but it takes an extra step.
With my modification, Ax will combine with all 3 of the other 3 CLAM outputs giving a single 12 CLAM output immediately (subject to thresholds, etc).
It just seems neater to treat all outputs as equal, whether they're from the same transaction or not.
Actually, why do we even care what address they're at? If I have two tiny outputs at different addresses and one of them is lucky enough to stake, why not combine the two tiny outputs into a less tiny one so that they have a decent chance of staking again sometime?
Maybe it's useful for accounting purposes. If I'm running a wallet site, say, maybe I choose to keep each user's deposit in their own address so I can keep track of how their coins stake, and merging across addresses would mess that up.
from clams.
I think your comment about 'wallet services' is apt. Unfortunately, you can't enforce proper design that doesn't rely on 'accounts' and per address accounting.
In the end, I think your logic is sound.
Assuming a loop condition with splitting and recombining can be avoided, and a reasonable split/combine threshold can be implemented via some difficulty/output size magic: I agree with the change.
from clams.
Related Issues (20)
- khashier block explorer isn't updating HOT 5
- Can't import wallet when password contains spaces? HOT 1
- clamav and clams: conflicting binary names /usr/bin/clamd
- Clam fail to build HOT 1
- Please help me guys, Sync issues HOT 9
- clamd 2.0.0-rc1 blockchain fork HOT 7
- -mininput fails to ignore some outputs HOT 1
- Change Name to BitcoinLitecoinAndDogecoinButNotNecessarilyInThatOrderClams HOT 7
- Bootstrap import ignores >300MB worth of already downloaded blk0001.dat HOT 11
- Status: conflicted, broadcast through 11 node(s)
- pre release v2.0.0-rc1 HOT 8
- Problems with RC2 HOT 2
- Improve homepage HOT 2
- Sendmany not working HOT 1
- clamd crashes (and freezes ubuntu EC2 box) HOT 1
- Compiling fails with recent openssl versions. HOT 9
- Cannot validate block HOT 2
- clamour not being set
- protected function HOT 1
- AcceptToMemoryPool : not enough fees
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clams.