mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge pull request #215 from vertoe/devel-0.9-upstr
Fix priority calculation in CreateTransaction
This commit is contained in:
commit
369ca60da7
@ -73,7 +73,7 @@ are testing multi-machine code that needs to operate across the internet.
|
|||||||
|
|
||||||
If you are testing something that can run on one machine, run with the -regtest option.
|
If you are testing something that can run on one machine, run with the -regtest option.
|
||||||
In regression test mode blocks can be created on-demand; see qa/rpc-tests/ for tests
|
In regression test mode blocks can be created on-demand; see qa/rpc-tests/ for tests
|
||||||
that run in -regest mode.
|
that run in -regtest mode.
|
||||||
|
|
||||||
**DEBUG_LOCKORDER**
|
**DEBUG_LOCKORDER**
|
||||||
|
|
||||||
|
39
doc/tor.md
39
doc/tor.md
@ -1,16 +1,19 @@
|
|||||||
TOR SUPPORT IN BITCOIN
|
TOR SUPPORT IN DARKCOIN
|
||||||
======================
|
=======================
|
||||||
|
|
||||||
It is possible to run Bitcoin as a Tor hidden service, and connect to such services.
|
It is possible to run Darkcoin as a Tor hidden service, and connect to such services.
|
||||||
|
|
||||||
The following directions assume you have a Tor proxy running on port 9050. Many distributions default to having a SOCKS proxy listening on port 9050, but others may not. In particular, the Tor Browser Bundle defaults to listening on a random port. See [Tor Project FAQ:TBBSocksPort](https://www.torproject.org/docs/faq.html.en#TBBSocksPort) for how to properly
|
The following directions assume you have a Tor proxy running on port 9050. Many
|
||||||
configure Tor.
|
distributions default to having a SOCKS proxy listening on port 9050, but others
|
||||||
|
may not. In particular, the Tor Browser Bundle defaults to listening on a random
|
||||||
|
port. See [Tor Project FAQ:TBBSocksPort](https://www.torproject.org/docs/faq.html.en#TBBSocksPort)
|
||||||
|
for how to properly configure Tor.
|
||||||
|
|
||||||
|
|
||||||
1. Run bitcoin behind a Tor proxy
|
1. Run darkcoin behind a Tor proxy
|
||||||
---------------------------------
|
----------------------------------
|
||||||
|
|
||||||
The first step is running Bitcoin behind a Tor proxy. This will already make all
|
The first step is running Darkcoin behind a Tor proxy. This will already make all
|
||||||
outgoing connections be anonymized, but more is possible.
|
outgoing connections be anonymized, but more is possible.
|
||||||
|
|
||||||
-socks=5 SOCKS5 supports connecting-to-hostname, which can be used instead
|
-socks=5 SOCKS5 supports connecting-to-hostname, which can be used instead
|
||||||
@ -36,27 +39,27 @@ outgoing connections be anonymized, but more is possible.
|
|||||||
|
|
||||||
In a typical situation, this suffices to run behind a Tor proxy:
|
In a typical situation, this suffices to run behind a Tor proxy:
|
||||||
|
|
||||||
./bitcoin -proxy=127.0.0.1:9050
|
./darkcoind -proxy=127.0.0.1:9050
|
||||||
|
|
||||||
|
|
||||||
2. Run a bitcoin hidden server
|
2. Run a darkcoin hidden server
|
||||||
------------------------------
|
-------------------------------
|
||||||
|
|
||||||
If you configure your Tor system accordingly, it is possible to make your node also
|
If you configure your Tor system accordingly, it is possible to make your node also
|
||||||
reachable from the Tor network. Add these lines to your /etc/tor/torrc (or equivalent
|
reachable from the Tor network. Add these lines to your /etc/tor/torrc (or equivalent
|
||||||
config file):
|
config file):
|
||||||
|
|
||||||
HiddenServiceDir /var/lib/tor/bitcoin-service/
|
HiddenServiceDir /var/lib/tor/darkcoin-service/
|
||||||
HiddenServicePort 9999 127.0.0.1:9999
|
HiddenServicePort 9999 127.0.0.1:9999
|
||||||
HiddenServicePort 19999 127.0.0.1:19999
|
HiddenServicePort 19999 127.0.0.1:19999
|
||||||
|
|
||||||
The directory can be different of course, but (both) port numbers should be equal to
|
The directory can be different of course, but (both) port numbers should be equal to
|
||||||
your bitcoind's P2P listen port (9999 by default).
|
your darkcoind's P2P listen port (9999 by default).
|
||||||
|
|
||||||
-externalip=X You can tell bitcoin about its publicly reachable address using
|
-externalip=X You can tell darkcoin about its publicly reachable address using
|
||||||
this option, and this can be a .onion address. Given the above
|
this option, and this can be a .onion address. Given the above
|
||||||
configuration, you can find your onion address in
|
configuration, you can find your onion address in
|
||||||
/var/lib/tor/bitcoin-service/hostname. Onion addresses are given
|
/var/lib/tor/darkcoin-service/hostname. Onion addresses are given
|
||||||
preference for your node to advertize itself with, for connections
|
preference for your node to advertize itself with, for connections
|
||||||
coming from unroutable addresses (such as 127.0.0.1, where the
|
coming from unroutable addresses (such as 127.0.0.1, where the
|
||||||
Tor proxy typically runs).
|
Tor proxy typically runs).
|
||||||
@ -73,18 +76,18 @@ your bitcoind's P2P listen port (9999 by default).
|
|||||||
|
|
||||||
In a typical situation, where you're only reachable via Tor, this should suffice:
|
In a typical situation, where you're only reachable via Tor, this should suffice:
|
||||||
|
|
||||||
./bitcoind -proxy=127.0.0.1:9050 -externalip=57qr3yd1nyntf5k.onion -listen
|
./darkcoind -proxy=127.0.0.1:9050 -externalip=ssapp53tmftyjmjb.onion -listen
|
||||||
|
|
||||||
(obviously, replace the Onion address with your own). If you don't care too much
|
(obviously, replace the Onion address with your own). If you don't care too much
|
||||||
about hiding your node, and want to be reachable on IPv4 as well, additionally
|
about hiding your node, and want to be reachable on IPv4 as well, additionally
|
||||||
specify:
|
specify:
|
||||||
|
|
||||||
./bitcoind ... -discover
|
./darkcoind ... -discover
|
||||||
|
|
||||||
and open port 9999 on your firewall (or use -upnp).
|
and open port 9999 on your firewall (or use -upnp).
|
||||||
|
|
||||||
If you only want to use Tor to reach onion addresses, but not use it as a proxy
|
If you only want to use Tor to reach onion addresses, but not use it as a proxy
|
||||||
for normal IPv4/IPv6 communication, use:
|
for normal IPv4/IPv6 communication, use:
|
||||||
|
|
||||||
./bitcoin -onion=127.0.0.1:9050 -externalip=57qr3yd1nyntf5k.onion -discover
|
./darkcoind -onion=127.0.0.1:9050 -externalip=ssapp53tmftyjmjb.onion -discover
|
||||||
|
|
||||||
|
@ -1887,10 +1887,14 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
|
|||||||
BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
|
BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
|
||||||
{
|
{
|
||||||
int64_t nCredit = pcoin.first->vout[pcoin.second].nValue;
|
int64_t nCredit = pcoin.first->vout[pcoin.second].nValue;
|
||||||
//The priority after the next block (depth+1) is used instead of the current,
|
//The coin age after the next block (depth+1) is used instead of the current,
|
||||||
//reflecting an assumption the user would accept a bit more delay for
|
//reflecting an assumption the user would accept a bit more delay for
|
||||||
//a chance at a free transaction.
|
//a chance at a free transaction.
|
||||||
dPriority += (double)nCredit * (pcoin.first->GetDepthInMainChain()+1);
|
//But mempool inputs might still be in the mempool, so their age stays 0
|
||||||
|
int age = pcoin.first->GetDepthInMainChain();
|
||||||
|
if (age != 0)
|
||||||
|
age += 1;
|
||||||
|
dPriority += (double)nCredit * age;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t nChange = nValueIn - nValue - nFeeRet;
|
int64_t nChange = nValueIn - nValue - nFeeRet;
|
||||||
|
Loading…
Reference in New Issue
Block a user