Skip to content

Commit 369ca60

Browse files
author
evan82
committed
Merge pull request #215 from vertoe/devel-0.9-upstr
Fix priority calculation in CreateTransaction
2 parents 8faca60 + 14bebe4 commit 369ca60

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ are testing multi-machine code that needs to operate across the internet.
7373

7474
If you are testing something that can run on one machine, run with the -regtest option.
7575
In regression test mode blocks can be created on-demand; see qa/rpc-tests/ for tests
76-
that run in -regest mode.
76+
that run in -regtest mode.
7777

7878
**DEBUG_LOCKORDER**
7979

doc/tor.md

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
TOR SUPPORT IN BITCOIN
2-
======================
1+
TOR SUPPORT IN DARKCOIN
2+
=======================
33

4-
It is possible to run Bitcoin as a Tor hidden service, and connect to such services.
4+
It is possible to run Darkcoin as a Tor hidden service, and connect to such services.
55

6-
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
7-
configure Tor.
6+
The following directions assume you have a Tor proxy running on port 9050. Many
7+
distributions default to having a SOCKS proxy listening on port 9050, but others
8+
may not. In particular, the Tor Browser Bundle defaults to listening on a random
9+
port. See [Tor Project FAQ:TBBSocksPort](https://www.torproject.org/docs/faq.html.en#TBBSocksPort)
10+
for how to properly configure Tor.
811

912

10-
1. Run bitcoin behind a Tor proxy
11-
---------------------------------
13+
1. Run darkcoin behind a Tor proxy
14+
----------------------------------
1215

13-
The first step is running Bitcoin behind a Tor proxy. This will already make all
16+
The first step is running Darkcoin behind a Tor proxy. This will already make all
1417
outgoing connections be anonymized, but more is possible.
1518

1619
-socks=5 SOCKS5 supports connecting-to-hostname, which can be used instead
@@ -36,27 +39,27 @@ outgoing connections be anonymized, but more is possible.
3639

3740
In a typical situation, this suffices to run behind a Tor proxy:
3841

39-
./bitcoin -proxy=127.0.0.1:9050
42+
./darkcoind -proxy=127.0.0.1:9050
4043

4144

42-
2. Run a bitcoin hidden server
43-
------------------------------
45+
2. Run a darkcoin hidden server
46+
-------------------------------
4447

4548
If you configure your Tor system accordingly, it is possible to make your node also
4649
reachable from the Tor network. Add these lines to your /etc/tor/torrc (or equivalent
4750
config file):
4851

49-
HiddenServiceDir /var/lib/tor/bitcoin-service/
52+
HiddenServiceDir /var/lib/tor/darkcoin-service/
5053
HiddenServicePort 9999 127.0.0.1:9999
5154
HiddenServicePort 19999 127.0.0.1:19999
5255

5356
The directory can be different of course, but (both) port numbers should be equal to
54-
your bitcoind's P2P listen port (9999 by default).
57+
your darkcoind's P2P listen port (9999 by default).
5558

56-
-externalip=X You can tell bitcoin about its publicly reachable address using
59+
-externalip=X You can tell darkcoin about its publicly reachable address using
5760
this option, and this can be a .onion address. Given the above
5861
configuration, you can find your onion address in
59-
/var/lib/tor/bitcoin-service/hostname. Onion addresses are given
62+
/var/lib/tor/darkcoin-service/hostname. Onion addresses are given
6063
preference for your node to advertize itself with, for connections
6164
coming from unroutable addresses (such as 127.0.0.1, where the
6265
Tor proxy typically runs).
@@ -73,18 +76,18 @@ your bitcoind's P2P listen port (9999 by default).
7376

7477
In a typical situation, where you're only reachable via Tor, this should suffice:
7578

76-
./bitcoind -proxy=127.0.0.1:9050 -externalip=57qr3yd1nyntf5k.onion -listen
79+
./darkcoind -proxy=127.0.0.1:9050 -externalip=ssapp53tmftyjmjb.onion -listen
7780

7881
(obviously, replace the Onion address with your own). If you don't care too much
7982
about hiding your node, and want to be reachable on IPv4 as well, additionally
8083
specify:
8184

82-
./bitcoind ... -discover
85+
./darkcoind ... -discover
8386

8487
and open port 9999 on your firewall (or use -upnp).
8588

8689
If you only want to use Tor to reach onion addresses, but not use it as a proxy
8790
for normal IPv4/IPv6 communication, use:
8891

89-
./bitcoin -onion=127.0.0.1:9050 -externalip=57qr3yd1nyntf5k.onion -discover
92+
./darkcoind -onion=127.0.0.1:9050 -externalip=ssapp53tmftyjmjb.onion -discover
9093

src/wallet.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -1887,10 +1887,14 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
18871887
BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
18881888
{
18891889
int64_t nCredit = pcoin.first->vout[pcoin.second].nValue;
1890-
//The priority after the next block (depth+1) is used instead of the current,
1890+
//The coin age after the next block (depth+1) is used instead of the current,
18911891
//reflecting an assumption the user would accept a bit more delay for
18921892
//a chance at a free transaction.
1893-
dPriority += (double)nCredit * (pcoin.first->GetDepthInMainChain()+1);
1893+
//But mempool inputs might still be in the mempool, so their age stays 0
1894+
int age = pcoin.first->GetDepthInMainChain();
1895+
if (age != 0)
1896+
age += 1;
1897+
dPriority += (double)nCredit * age;
18941898
}
18951899

18961900
int64_t nChange = nValueIn - nValue - nFeeRet;

0 commit comments

Comments
 (0)