mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 02:35:52 +00:00
GetDataMessage: Support fetching of blocks with witnesses.
This commit is contained in:
parent
1852ba7e8e
commit
8910cd7a25
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011 Google Inc.
|
* Copyright 2011 Google Inc.
|
||||||
|
* Copyright 2019 Andreas Schildbach
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -51,8 +52,8 @@ public class GetDataMessage extends ListMessage {
|
|||||||
includeWitness ? InventoryItem.Type.WITNESS_TRANSACTION : InventoryItem.Type.TRANSACTION, hash));
|
includeWitness ? InventoryItem.Type.WITNESS_TRANSACTION : InventoryItem.Type.TRANSACTION, hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBlock(Sha256Hash hash) {
|
public void addBlock(Sha256Hash hash, boolean includeWitness) {
|
||||||
addItem(new InventoryItem(InventoryItem.Type.BLOCK, hash));
|
addItem(new InventoryItem(includeWitness ? InventoryItem.Type.WITNESS_BLOCK : InventoryItem.Type.BLOCK, hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFilteredBlock(Sha256Hash hash) {
|
public void addFilteredBlock(Sha256Hash hash) {
|
||||||
|
@ -1288,7 +1288,7 @@ public class Peer extends PeerSocketHandler {
|
|||||||
getdata.addFilteredBlock(item.hash);
|
getdata.addFilteredBlock(item.hash);
|
||||||
pingAfterGetData = true;
|
pingAfterGetData = true;
|
||||||
} else {
|
} else {
|
||||||
getdata.addBlock(item.hash);
|
getdata.addBlock(item.hash, vPeerVersionMessage.isWitnessSupported());
|
||||||
}
|
}
|
||||||
pendingBlockDownloads.add(item.hash);
|
pendingBlockDownloads.add(item.hash);
|
||||||
}
|
}
|
||||||
@ -1326,7 +1326,7 @@ public class Peer extends PeerSocketHandler {
|
|||||||
// This does not need to be locked.
|
// This does not need to be locked.
|
||||||
log.info("Request to fetch block {}", blockHash);
|
log.info("Request to fetch block {}", blockHash);
|
||||||
GetDataMessage getdata = new GetDataMessage(params);
|
GetDataMessage getdata = new GetDataMessage(params);
|
||||||
getdata.addBlock(blockHash);
|
getdata.addBlock(blockHash, true);
|
||||||
return sendSingleGetData(getdata);
|
return sendSingleGetData(getdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user