tree checksum vpatch file split hunks

all signers: mircea_popescu trinque ben_vulpes mod6 asciilifeform

antecedents: asciilifeform_ver_now_5_4_and_irc_is_gone_and_now_must_give_ip programmable-versionstring mod6_der_high_low_s

press order:

genesisasciilifeform ben_vulpes mircea_popescu mod6 trinque
bitcoin-asciilifeform.1asciilifeform ben_vulpes mod6
rm_rf_upnpasciilifeform ben_vulpes mod6
bitcoin-asciilifeform.3-turdmeister-alert-snipasciilifeform ben_vulpes mod6
asciilifeform_orphanage_thermonukeasciilifeform ben_vulpes mod6
bitcoin-asciilifeform.2-https_snipsnipasciilifeform ben_vulpes mod6
bitcoin-v0_5_3_1-static_makefile_v002.8asciilifeform ben_vulpes mod6
bitcoin-asciilifeform.4-goodbye-win32asciilifeform ben_vulpes mod6
bitcoin-v0_5_3_1-rev_bump.7asciilifeform ben_vulpes mod6
asciilifeform_tx-orphanage_amputationasciilifeform ben_vulpes mod6
asciilifeform_dnsseed_snipsnipasciilifeform ben_vulpes mod6
asciilifeform_zap_hardcoded_seedsasciilifeform ben_vulpes mod6
asciilifeform_zap_showmyip_crudasciilifeform ben_vulpes mod6
asciilifeform_dns_thermonyukyoolar_kleansingasciilifeform ben_vulpes mod6
asciilifeform_ver_now_5_4_and_irc_is_gone_and_now_must_give_ipasciilifeform ben_vulpes mod6
asciilifeform-kills-integer-retardationasciilifeform ben_vulpes mod6
asciilifeform_and_now_we_have_block_dumper_correctedasciilifeform ben_vulpes mod6
mod6_fix_dumpblock_paramsasciilifeform ben_vulpes mod6
asciilifeform_and_now_we_have_eatblockasciilifeform ben_vulpes mod6
asciilifeform_lets_lose_testnetasciilifeform ben_vulpes mod6
asciilifeform_add_verifyall_optionasciilifeform ben_vulpes mod6
programmable-versionstringben_vulpes mod6
mod6_der_high_low_sben_vulpes mod6
asciilifeform_shiva_part_2_of_2asciilifeform

patch:

- 971B82BE435C99A1AF9D5CACC9C05AF7616F4AF7EE1466EFACD46D41EDDC1C4D7DA2FDB4A302AAB7C99933D33AD2D613F3BFBE76FEC67A71C6D4D1FE14AC142D
+ 2F6AB82EBAB26369954CF9CA518E536A03C2A989D978823D6D78E1A924E601C855A8598863A5845727A93A457D49537CA91E027D69603ABC1CB6F075E69AF8D0
bitcoin/src/init.cpp
(5 . 6)(5 . 7)
5 #include "headers.h"
6 #include "db.h"
7 #include "bitcoinrpc.h"
8 #include "shiva.h"
9 #include "net.h"
10 #include "init.h"
11 #include "strlcpy.h"
(177 . 6)(178 . 9)
13 " -verifyall \t\t " + _("Forbid the skipping of ECDSA signature verification between checkpoints.\n") +
14 " -setverstring \t\t " + _("Set a custom version string.\n") +
15 " -setvernum \t\t " + _("Set a custom version number.\n") +
16 " -shiva \t\t " + _("Enable the Shiva lisp listener (DANGEROUS!).\n") +
17 " -shivainit=<file>\t\t " + _("Init file for Shiva (default: shiva.scm)\n") +
18 " -shivaport=<port>\t\t " + _("Listen for Shiva connections on <port> (default: 1336)\n") +
19 " -highs \t\t " + _("Set all transactions to have DER 'S' Value set to 'high'.\n") +
20 " -lows \t\t " + _("Set all transactions to have DER 'S' Value set to 'low'.\n") +
21 " -logtimestamps \t " + _("Prepend debug output with timestamp\n") +
(202 . 6)(206 . 13)
23 fDaemon = GetBoolArg("-daemon");
24 fCanEat = GetBoolArg("-caneat");
25 fVerifyAll = GetBoolArg("-verifyall");
26 fShiva = GetBoolArg("-shiva");
27
28 if (!(mapArgs.count("-shivainit") && FileExists(mapArgs["-shivainit"].c_str()))) {
29 fprintf(stderr, "Error: If Shiva is enabled, MUST specify init file!\n");
30 return false;
31 }
32
33 fHighS = GetBoolArg("-highs");
34 fLowS = GetBoolArg("-lows");
35
(487 . 6)(498 . 10)
37 if (fServer)
38 CreateThread(ThreadRPCServer, NULL);
39
40 if (fShiva) {
41 CreateThread(ThreadShiva, NULL);
42 }
43
44 while (1)
45 Sleep(5000);
46
- 9B88B8F60D9A0AE98F9DD148DBA06E132B6B1FC199719EACB3270FE6CE2AF889422EEE62C2CB08C3B93F22069AEA880C657E771C4E4B4157A69C321550C8FC73
+ C6C24FCA798BB308EB94D61854BD19A31384C9A6EE20EE9FF90E7E1CAD6EE9FA93C44DFEB80265F61D4CA6CDF100BB530BB22EC4AB69A7CF0699ACD19DC4A267
bitcoin/src/knobs.h
(4 . 4)(4 . 6)
51 #define DEFAULT_CLIENT_NAME "therealbitcoin.org"
52 #define DEFAULT_CLIENT_VERSION 99999 /* 50400 */
53
54 #define DEFAULT_SHIVA_PORT 1336
55
56 #endif
- 09AC104678A444430D3EF0BDF6DBD07D875666493B2D938AC6AA7FB67ABE840F2254F517055F4B5F90D0E86C83EE3DADE77A58F1C37B7AB7B4C13598A5559ADC
+ BB1A279DE6E10446B679B247DCCD421EFD70CEE90177D797E08E078C49B9A03276D5B2E194F0459375B94B95877CBAD34E8BB2A2D94246A13D5C5E71D8EE41C3
bitcoin/src/makefile.unix
(71 . 6)(71 . 7)
61 DEBUGFLAGS=-g
62 CXXFLAGS=-O2
63 xCXXFLAGS=-pthread -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS)
64 CFLAGS=-lm -DUSE_ASCII_NAMES=0 -O2
65 HEADERS = \
66 base58.h \
67 bignum.h \
(87 . 6)(88 . 7)
69 noui.h \
70 protocol.h \
71 bitcoinrpc.h \
72 shiva.h \
73 script.h \
74 serialize.h \
75 strlcpy.h \
(104 . 15)(106 . 18)
77 obj/net.o \
78 obj/protocol.o \
79 obj/bitcoinrpc.o \
80 obj/shiva.o \
81 obj/script.o \
82 obj/util.o \
83 obj/wallet.o
84 obj/wallet.o \
85 obj-shiva/scheme.o
86
87
88 all: bitcoind
89
90 # auto-generated dependencies:
91 -include obj/nogui/*.P
92 -include obj-shiva/*.P
93 -include obj-test/*.P
94
95 obj/nogui/%.o: %.cpp
(122 . 6)(127 . 13)
97 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
98 rm -f $(@:%.o=%.d)
99
100 obj-shiva/%.o: shiva/%.c
101 $(CC) -c $(TESTDEFS) $(CFLAGS) -MMD -o $@ $<
102 @cp $(@:%.o=%.d) $(@:%.o=%.P); \
103 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
104 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
105 rm -f $(@:%.o=%.d)
106
107 bitcoind: $(OBJS:obj/%=obj/nogui/%)
108 $(CXX) $(xCXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
109
(139 . 6)(151 . 8)
111 -rm -f bitcoind test_bitcoin
112 -rm -f obj/*.o
113 -rm -f obj/nogui/*.o
114 -rm -f obj-shiva/*.o
115 -rm -f obj-shiva/*.P
116 -rm -f obj-test/*.o
117 -rm -f obj/*.P
118 -rm -f obj/nogui/*.P
- 31EB2CBDF4F83F10AE8A7CDD3A69312BA6EAFBECFAFBEDDF7546CE99847BD4F2A674037E2B89A0A7B91C37127D9770501C265A7977EDB0AE0B3A5964272692F9
+ 1AAE02F75E5CA6C54BF3EB97D2BCA1CA675D64AA220653964DC44806898D3C3CBBB89AE6760637B2367054114AF76DCE5549E95D5A9A661B83F2F599BB68496F
bitcoin/src/net.cpp
(1312 . 7)(1312 . 7)
123 fShutdown = true;
124 nTransactionsUpdated++;
125 int64 nStart = GetTime();
126 while (vnThreadsRunning[0] > 0 || vnThreadsRunning[1] > 0 || vnThreadsRunning[2] > 0 || vnThreadsRunning[3] > 0 || vnThreadsRunning[4] > 0
127 while (vnThreadsRunning[0] > 0 || vnThreadsRunning[1] > 0 || vnThreadsRunning[2] > 0 || vnThreadsRunning[3] > 0 || vnThreadsRunning[4] > 0 || vnThreadsRunning[5] > 0
128 )
129 {
130 if (GetTime() - nStart > 20)
(1324 . 6)(1324 . 7)
132 if (vnThreadsRunning[2] > 0) printf("ThreadMessageHandler still running\n");
133 if (vnThreadsRunning[3] > 0) printf("ThreadBitcoinMiner still running\n");
134 if (vnThreadsRunning[4] > 0) printf("ThreadRPCServer still running\n");
135 if (vnThreadsRunning[5] > 0) printf("ThreadShiva still running\n");
136 while (vnThreadsRunning[2] > 0 || vnThreadsRunning[4] > 0)
137 Sleep(20);
138 Sleep(50);
-
+ BB607D1E17C0C4025E74D298C4FC3A65A824ED8C55401748FB6FF1F73FEC5B5A2C92CF686516DCC119FFB28128BF07162CC70E7F144DE2773A0C28832AAB3C8A
bitcoin/src/shiva.cpp
(0 . 0)(1 . 195)
143 #include <string>
144 #include <cstdio>
145
146 #include <string.h> /* memset() */
147 #include <sys/socket.h>
148 #include <netinet/in.h>
149 #include <arpa/inet.h>
150 #include <unistd.h>
151 #include <netdb.h>
152 #include <pthread.h>
153 #include <fcntl.h>
154 #include <getopt.h>
155
156 #include <boost/algorithm/string.hpp>
157 #include <boost/filesystem.hpp>
158 #include <boost/filesystem/fstream.hpp>
159
160 #include "knobs.h"
161 #include "headers.h"
162 #include "db.h"
163 #include "net.h"
164 #include "init.h"
165 #include "util.h"
166 #include "shiva.h"
167
168
169 using namespace std;
170 using namespace scm;
171
172 static void *repl_runner(void *sock);
173 static void init_shiva_hooks(scheme *sc);
174 void ThreadShiva2(void *parg);
175
176
177 //////////////////////////////////////////////////////////////////////////////
178 /* Socketronic Housekeeping. */
179 //////////////////////////////////////////////////////////////////////////////
180
181
182 void ThreadShiva(void* parg) {
183 IMPLEMENT_RANDOMIZE_STACK(ThreadShiva(parg));
184 try {
185 vnThreadsRunning[5]++;
186 ThreadShiva2(parg);
187 vnThreadsRunning[5]--;
188 }
189 catch (std::exception& e) {
190 vnThreadsRunning[5]--;
191 PrintException(&e, "ThreadShiva()");
192 } catch (...) {
193 vnThreadsRunning[5]--;
194 PrintException(NULL, "ThreadShiva()");
195 }
196 printf("ThreadShiva exiting\n");
197 }
198
199
200 void ThreadShiva2(void* parg) {
201 printf("ThreadShiva started\n");
202
203 int port = GetArg("-shivaport", DEFAULT_SHIVA_PORT);
204 int listenfd, optval = 1;
205 struct sockaddr_in serveraddr;
206 pthread_t thread;
207
208 if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
209 throw runtime_error("Shiva: socket() fail.");
210
211 if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (const void *)&optval , sizeof(int)) < 0)
212 throw runtime_error("Shiva: setsockopt() fail.");
213
214 bzero((char *) &serveraddr, sizeof(serveraddr));
215 serveraddr.sin_family = AF_INET;
216 serveraddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); /* ONLY localhost !*/
217 serveraddr.sin_port = htons((unsigned short)port);
218
219 if (bind(listenfd, (struct sockaddr*)&serveraddr, sizeof(serveraddr)) < 0)
220 throw runtime_error("Shiva: bind() fail.");
221
222 if (listen(listenfd, BACKLOG) < 0)
223 throw runtime_error("Shiva: listen() fail.");
224
225 printf("ThreadShiva listening on port %ld...\n", port);
226
227 while (!fShutdown) {
228 size_t size = sizeof(struct sockaddr_in);
229 struct sockaddr_in their_addr;
230 int newsock = accept(listenfd, (struct sockaddr*)&their_addr, ((socklen_t *)&size));
231 if (newsock == -1) {
232 throw runtime_error("Shiva: accept() fail.");
233 } else {
234 printf("Shiva: new session, connected from %s:%d\n",
235 inet_ntoa(their_addr.sin_addr), htons(their_addr.sin_port));
236
237 /*
238 This will probably have to change.
239 IMHO we do need multi-threaded Shiva, because having something like SLIME
240 working with it is The Right Thing, and this needs multiple REPLs.
241 On the other hand, it would also be quite fine to have exactly one REPL,
242 esp. if it persisted between sessions.
243 */
244
245 if (pthread_create(&thread, NULL, repl_runner, &newsock) != 0) {
246 throw runtime_error("Shiva: thread spawn fail.");
247 }
248 }
249 }
250
251 close(listenfd);
252 }
253
254
255 /* Load Shiva init file. Mandatory. */
256 static int read_init_file(const char *shiva_init_path, scheme* sc, FILE* fd_socket) {
257 FILE* fp;
258 fp = fopen(shiva_init_path, "r");
259 if (fp != NULL) {
260 if (fd_socket)
261 fprintf(fd_socket, "Shiva: using init file %s\n", shiva_init_path);
262 scheme_load_named_file(sc, fp, shiva_init_path);
263 if (sc->retcode!=0 && fd_socket) {
264 fprintf(fd_socket, "Errors encountered reading %s\n", shiva_init_path);
265 throw runtime_error("Shiva: failed to read init file!");
266 }
267 fclose(fp);
268 return sc->retcode;
269 } else {
270 return 0;
271 }
272 }
273
274
275 /* The room where it happens! */
276 static void *repl_runner(void *sock) {
277 int sockfd = *((int*)sock);
278 FILE *fdin, *fdout;
279 scheme sc;
280
281 vnThreadsRunning[5]++;
282
283 /* intialize the scheme object */
284 if (!scheme_init(&sc)) {
285 fprintf(stderr,"Could not initialize scheme interpreter!\n");
286 return NULL;
287 }
288
289 fdin = fdopen(sockfd, "r");
290 fdout = fdopen(sockfd, "w");
291
292 /* set standard input and output ports */
293 sc.interactive_repl = 1;
294 scheme_set_input_port_file(&sc, fdin);
295 scheme_set_output_port_file(&sc, fdout);
296
297 read_init_file(mapArgs["-shivainit"].c_str(), &sc, fdout);
298 init_shiva_hooks(&sc);
299 /* Jump into session */
300 scheme_load_named_file(&sc, fdin, 0);
301
302 printf("Shiva: closed session.\n");
303
304 fclose(fdin);
305 fclose(fdout);
306 close(sockfd);
307 scheme_deinit(&sc);
308
309 vnThreadsRunning[5]--;
310
311 return NULL;
312 }
313
314
315 //////////////////////////////////////////////////////////////////////////////
316 /* Now Taste The Meat. */
317 //////////////////////////////////////////////////////////////////////////////
318
319
320 /* Get current best blockheight. */
321 static pointer btc_get_best_height(scheme *sc, pointer args) {
322 return sc->vptr->mk_integer(sc, nBestHeight);
323 }
324
325
326 /* Initite a shutdown. */
327 static pointer btc_shutdown(scheme *sc, pointer args) {
328 CreateThread(Shutdown, NULL);
329 return sc->NIL;
330 }
331
332
333 /* Install the hooks. For each of the above, must do this: */
334 static void init_shiva_hooks(scheme *sc) {
335 scheme_define(sc, sc->global_env, mk_symbol(sc, "btc-get-best-height" ), mk_foreign_func(sc, btc_get_best_height));
336 scheme_define(sc, sc->global_env, mk_symbol(sc, "btc-shutdown" ), mk_foreign_func(sc, btc_shutdown));
337 }
-
+ 1276267C579B82EF2D3970F1A55EB55546250669F23B9C85DA4B690BA779CC0820DF34F5EC179804C59C936687FF209EC8EC360CA30D9D0344B6AC477574B0FC
bitcoin/src/shiva.h
(0 . 0)(1 . 15)
342 #ifndef SHIVA_H
343 #define SHIVA_H
344
345 #define BACKLOG 10 /* listen() */
346
347 namespace scm {
348 /* We do this because the OP_* symbols in tinyscheme
349 clash with trb's script ops */
350 #include "shiva/scheme-private.h"
351 }
352
353 void ThreadShiva(void* parg);
354
355 #endif
356
- 66A8AC388136ACEAC7D24BD73C18B06445C2580849DD6C548D6684B5F1E9C19EAFD3F71427476FD982383DCFD0425F34CE524EAC1D8320FD990A28A1E4933288
+ 568CA27A4F90DC47F125880F64EE42DFEB0493A5E0EF79E314C3DF1702920C21D7AEA35CF197916A9881B569500C815D09E932F4668DEEF84507A26D7557B1CF
bitcoin/src/util.cpp
(23 . 6)(23 . 7)
361 bool fPrintToDebugger = false;
362 bool fCanEat = false;
363 bool fVerifyAll = false;
364 bool fShiva = false;
365 char pszSetDataDir[MAX_PATH] = "";
366 bool fRequestShutdown = false;
367 bool fShutdown = false;
(787 . 7)(788 . 14)
369 }
370
371
372
373 bool FileExists(const char *path) {
374 FILE *file = fopen(path, "r");
375 if (file) {
376 fclose(file);
377 return true;
378 }
379 return false;
380 }
381
382
383
- F0C21C349B56516FEAC63C9CF8018C82B26583AD290A4B3610965E5A5A703D116671B1EF270395B8289C170B603630B5B7E493725E420E187BA1FBD326061FF5
+ B171F0824811472EDB2E309537B772583A32B678550080F257D4B535BB62F46C04AAF0047D29500DF6CA77A7E2C01D729B4536B7B7869061863012E39B6C026F
bitcoin/src/util.h
(112 . 6)(112 . 7)
388 extern bool fPrintToDebugger;
389 extern bool fCanEat;
390 extern bool fVerifyAll;
391 extern bool fShiva;
392 extern char pszSetDataDir[MAX_PATH];
393 extern bool fRequestShutdown;
394 extern bool fShutdown;
(157 . 6)(158 . 7)
396 std::string GetDefaultDataDir();
397 std::string GetDataDir();
398 void ShrinkDebugFile();
399 bool FileExists(const char *path);
400 int GetRandInt(int nMax);
401 uint64 GetRand(uint64 nMax);
402 int64 GetTime();