Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/Stratis.Bitcoin.Features.Interop/CirrusContractClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,25 +259,33 @@ public async Task<CirrusReceiptResponse> GetReceiptAsync(string txHash)

public async Task<NBitcoin.Block> GetBlockByHeightAsync(int blockHeight)
{
string blockHash = await this.cirrusInteropSettings.CirrusClientUrl
string blockHash;

using (CancellationTokenSource cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(GetReceiptWaitTimeSeconds)))
{
blockHash = await this.cirrusInteropSettings.CirrusClientUrl
.AppendPathSegment("api/Consensus/getblockhash")
.SetQueryParam("height", blockHeight)
.GetJsonAsync<string>()
.GetJsonAsync<string>(cancellation.Token)
.ConfigureAwait(false);
}

if (blockHash == null)
if (string.IsNullOrEmpty(blockHash))
return null;

var hexResponse = await this.cirrusInteropSettings.CirrusClientUrl
using (CancellationTokenSource cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(GetReceiptWaitTimeSeconds)))
{
var hexResponse = await this.cirrusInteropSettings.CirrusClientUrl
.AppendPathSegment("api/BlockStore/block")
.SetQueryParam("Hash", blockHash)
.SetQueryParam("ShowTransactionDetails", false)
.SetQueryParam("OutputJson", false)
.GetStringAsync()
.GetStringAsync(cancellation.Token)
.ConfigureAwait(false);

var block = NBitcoin.Block.Parse(JsonConvert.DeserializeObject<string>(hexResponse), this.chainIndexer.Network.Consensus.ConsensusFactory);
return block;
var block = NBitcoin.Block.Parse(JsonConvert.DeserializeObject<string>(hexResponse), this.chainIndexer.Network.Consensus.ConsensusFactory);
return block;
}
}

public async Task<TransactionVerboseModel> GetRawTransactionAsync(string transactionId)
Expand Down
9 changes: 5 additions & 4 deletions src/Stratis.Bitcoin.Features.Interop/InteropPoller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,13 @@ public async Task InitializeAsync()
return;
}

// In the event that the last polled block was set back a considerable distance from the tip, we need to first catch up faster.
// If we are already in the acceptable range, the usual logic will apply.
await EnsureLastPolledBlockIsSyncedWithCirrusChainAsync().ConfigureAwait(false);

try
{
// In the event that the last polled block was set back a considerable distance from the tip, we need to first catch up faster.
// If we are already in the acceptable range, the usual logic will apply.
// This needs to be in the try catch so that any exceptions don't break the async loop.
await EnsureLastPolledBlockIsSyncedWithCirrusChainAsync().ConfigureAwait(false);

CheckForBlockHeightOverrides(DestinationChain.CIRRUS);

var cirrusTipHeight = this.chainIndexer.Tip.Height;
Expand Down
3 changes: 2 additions & 1 deletion src/Stratis.Bitcoin.Networks/StraxMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ public StraxMain()
{ 600_000, new CheckpointInfo(new uint256("0xde6e45862b53aa12e68ebe1ce58962a35dc44c9b6357d6137d6f4d72a7799262"), new uint256("0xc1b1e2c3417c1d41e906a53028421bec3a1f8969cf38516671433c2c85ef09d3")) },
{ 700_000, new CheckpointInfo(new uint256("0x9383c8d2cb72273ec784c8bca40fd8aedb5014080b30e664e7025f9733e28cd4"), new uint256("0x2a90ab7ce85e1733631282f9cc392aa8b6f8a352234a8c992d38ff1651b039af")) },
{ 750_000, new CheckpointInfo(new uint256("0x16a24a00b59bf1f0a366be26f6da9bc12814f315cbaac6b536494555f065f5d0"), new uint256("0x54426d468d84dd4b54adbedf62458c175235e23af537876150853738b6adfacf")) },
{ 1_000_000, new CheckpointInfo(new uint256("0x07e8f90f21ecfe1141b6b0b6c59f36bf350239e2facd92cf3e68bb81e105a3cc"), new uint256("0xf50f158adb8242b89d38e097b505fd0339bbd696d8f158d2751fe9504f0409e9")) }
{ 1_000_000, new CheckpointInfo(new uint256("0x07e8f90f21ecfe1141b6b0b6c59f36bf350239e2facd92cf3e68bb81e105a3cc"), new uint256("0xf50f158adb8242b89d38e097b505fd0339bbd696d8f158d2751fe9504f0409e9")) },
{ 1_200_000, new CheckpointInfo(new uint256("0xada257ccb7dad06680b54202695cc2615523d7405c151cd47f1d80a3f92706ae"), new uint256("0x6f6d74c6cd3ca84a9f2a1ff2ac40e5318acbe8bf76fbe0b9c174569f2421288f")) },
};

this.Bech32Encoders = new Bech32Encoder[2];
Expand Down
1 change: 1 addition & 0 deletions src/Stratis.Bitcoin.Networks/StraxTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public StraxTest()
{ 750_000, new CheckpointInfo(new uint256("0x592842f3e5af517b0ce6f451f6b61738a6dea1007ccbaab39f22878de8de78dc"), new uint256("0x6ee053737f80a3a5173c10a507b1d1ea2ec9f6fa6be07b2b9d26558e4622f4a4")) },
{ 800_000, new CheckpointInfo(new uint256("0x70c51661a4b358c42984019ee5dac9faee2f724860f651f8d78ed309e137f957"), new uint256("0x82ddde3f4e73a2eb69907b3f07f1f70f4c3b7e95812590fdef1050afb253cf84")) },
{ 1_000_000, new CheckpointInfo(new uint256("0xdde93ee6c33d08f3e7759b5f4e245dc716d7dc08444228bc6c8930d03add89f8"), new uint256("0xb6f4354685af869a59c020e6a7755366c12c99d348a14105e455b4d71a1113dd")) },
{ 1_250_000, new CheckpointInfo(new uint256("0xa8e76aaded9383220131dcd567e1fc7984c6703f03d6fd52809a29d37661898f"), new uint256("0x142064258753fbd80adf77540059985a075316d34cf479674d9fdc3e44216c54")) },
};

this.Bech32Encoders = new Bech32Encoder[2];
Expand Down
4 changes: 2 additions & 2 deletions src/Stratis.Bitcoin.Tests/Consensus/CheckpointsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void GetLastCheckPointHeight_StraxMainnet_ReturnsLastCheckPointHeight()

int result = checkpoints.GetLastCheckpointHeight();

Assert.Equal(1_000_000, result);
Assert.Equal(1_200_000, result);
}

[Fact]
Expand All @@ -84,7 +84,7 @@ public void GetLastCheckPointHeight_StraxTestnet_ReturnsLastCheckPointHeight()

int result = checkpoints.GetLastCheckpointHeight();

Assert.Equal(1_000_000, result);
Assert.Equal(1_250_000, result);
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions src/Stratis.Bitcoin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.2.2")]
[assembly: AssemblyFileVersion("1.3.2.2")]
[assembly: AssemblyVersion("1.3.2.3")]
[assembly: AssemblyFileVersion("1.3.2.3")]
[assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")]
2 changes: 1 addition & 1 deletion src/Stratis.Bitcoin/Stratis.Bitcoin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<Version>1.3.2.2</Version>
<Version>1.3.2.3</Version>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<CodeAnalysisRuleSet>..\Stratis.ruleset</CodeAnalysisRuleSet>
<Authors>Stratis Group Ltd.</Authors>
Expand Down
3 changes: 2 additions & 1 deletion src/Stratis.Sidechains.Networks/CirrusMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ public CirrusMain()
{ 3_500_000, new CheckpointInfo(new uint256("0x1772356d6498935ab93cbd5eaf1b868c5265480edeef2b5fec133fbc21b292cb")) },
{ 3_700_000, new CheckpointInfo(new uint256("0x16b41558dedb4945476f0212034bd148bef3cdeccdd1b55a198f8b1d6900716b")) },
{ 3_834_160, new CheckpointInfo(new uint256("0xa0e7b27d1e642301a5b3a985dc98953858d89849e9b864de7e9b62e6856973a0")) },
{ 4_100_000, new CheckpointInfo(new uint256("0x4f099739c22560ce27b7d5e6d30e86e7e6f52062504f0d31c25a427074de85f8")) }
{ 4_100_000, new CheckpointInfo(new uint256("0x4f099739c22560ce27b7d5e6d30e86e7e6f52062504f0d31c25a427074de85f8")) },
{ 4_800_000, new CheckpointInfo(new uint256("0xed81ddcdd743bdc2c74bbf16fce61082409169c45f95cfc4767d6e50e1b2833d")) }
};

this.DNSSeeds = new List<DNSSeedData>
Expand Down
3 changes: 2 additions & 1 deletion src/Stratis.Sidechains.Networks/CirrusTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ public CirrusTest()
{ 3_219_570, new CheckpointInfo(new uint256("0xb08c34d0879c65f6e3649eff05853a8d38081d898230beb671b591179f57892d")) },
{ 3_275_480, new CheckpointInfo(new uint256("0x70d4dd9bae9db409c0df441d3afb430821f85f166223357a456e4a2ba5c478af")) },
{ 3_300_000, new CheckpointInfo(new uint256("0x83e45cb4c85087819169f3f0793eeacd1899a1b5882b505d8e407d0f035eb116")) },
{ 3_400_000, new CheckpointInfo(new uint256("0xa0d62c480085e20d94a8650949eb47579a62c4da99d5e78914f67bb911ce6b27")) }
{ 3_400_000, new CheckpointInfo(new uint256("0xa0d62c480085e20d94a8650949eb47579a62c4da99d5e78914f67bb911ce6b27")) },
{ 3_850_000, new CheckpointInfo(new uint256("0xc427aca59ce98cb21a7ebd3b8850012277704625c334ed6715fd0e5277a11d42")) }
};

this.DNSSeeds = new List<DNSSeedData>
Expand Down