Repository: kaspanet/kaspad
Pull request #1681 (2021-04-19 07:00:45)

Move pow package from model to utils

codecov[bot]: # [Codecov](https://codecov.io/gh/kaspanet/kaspad/pull/1681?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet) Report
> Merging [#1681](https://codecov.io/gh/kaspanet/kaspad/pull/1681?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet) (755e54d) into [v0.10.0-dev](https://codecov.io/gh/kaspanet/kaspad/commit/83beae44630e1e600ef9e0b5de7789a252996a6e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet) (83beae4) will **decrease** coverage by `0.00%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/kaspanet/kaspad/pull/1681/graphs/tree.svg?width=650&height=150&src=pr&token=2FBIEEJTNU&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet)](https://codecov.io/gh/kaspanet/kaspad/pull/1681?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet)

```diff
@@               Coverage Diff               @@
##           v0.10.0-dev    #1681      +/-   ##
===============================================
- Coverage        59.36%   59.35%   -0.01%     
===============================================
  Files              550      550              
  Lines            21838    21838              
===============================================
- Hits             12964    12962       -2     
- Misses            6815     6817       +2     
  Partials          2059     2059              
```


| [Impacted Files](https://codecov.io/gh/kaspanet/kaspad/pull/1681?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet) | Coverage Δ | |
|---|---|---|
| [cmd/kaspaminer/mineloop.go](https://codecov.io/gh/kaspanet/kaspad/pull/1681/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet#diff-Y21kL2thc3BhbWluZXIvbWluZWxvb3AuZ28=) | `0.00% <ø> (ø)` | |
| [.../pruning\_violation\_proof\_of\_work\_and\_difficulty.go](https://codecov.io/gh/kaspanet/kaspad/pull/1681/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet#diff-ZG9tYWluL2NvbnNlbnN1cy9wcm9jZXNzZXMvYmxvY2t2YWxpZGF0b3IvcHJ1bmluZ192aW9sYXRpb25fcHJvb2Zfb2Zfd29ya19hbmRfZGlmZmljdWx0eS5nbw==) | `75.00% <ø> (ø)` | |
| [domain/consensus/utils/mining/solve.go](https://codecov.io/gh/kaspanet/kaspad/pull/1681/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet#diff-ZG9tYWluL2NvbnNlbnN1cy91dGlscy9taW5pbmcvc29sdmUuZ28=) | `85.71% <ø> (ø)` | |
| [domain/consensus/utils/pow/pow.go](https://codecov.io/gh/kaspanet/kaspad/pull/1681/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet#diff-ZG9tYWluL2NvbnNlbnN1cy91dGlscy9wb3cvcG93Lmdv) | `79.16% <ø> (ø)` | |
| [app/protocol/flows/blockrelay/handle\_relay\_invs.go](https://codecov.io/gh/kaspanet/kaspad/pull/1681/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet#diff-YXBwL3Byb3RvY29sL2Zsb3dzL2Jsb2NrcmVsYXkvaGFuZGxlX3JlbGF5X2ludnMuZ28=) | `68.75% <0.00%> (-1.25%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/kaspanet/kaspad/pull/1681?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/kaspanet/kaspad/pull/1681?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet). Last update [83beae4...755e54d](https://codecov.io/gh/kaspanet/kaspad/pull/1681?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kaspanet).


Patch:
diff --git a/cmd/kaspaminer/mineloop.go b/cmd/kaspaminer/mineloop.go
index 6ece1789..ebba8a18 100644
--- a/cmd/kaspaminer/mineloop.go
+++ b/cmd/kaspaminer/mineloop.go
@@ -6,18 +6,14 @@ import (
 	"sync/atomic"
 	"time"
 
+	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/cmd/kaspaminer/templatemanager"
-	"github.com/kaspanet/kaspad/domain/consensus/model/pow"
-	"github.com/kaspanet/kaspad/util/difficulty"
-
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
-
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-
-	"github.com/kaspanet/kaspad/app/appmessage"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/pow"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
-
 	"github.com/kaspanet/kaspad/util"
+	"github.com/kaspanet/kaspad/util/difficulty"
 	"github.com/pkg/errors"
 )
 
diff --git a/domain/consensus/processes/blockvalidator/pruning_violation_proof_of_work_and_difficulty.go b/domain/consensus/processes/blockvalidator/pruning_violation_proof_of_work_and_difficulty.go
index a6d51bdc..4f9abd81 100644
--- a/domain/consensus/processes/blockvalidator/pruning_violation_proof_of_work_and_difficulty.go
+++ b/domain/consensus/processes/blockvalidator/pruning_violation_proof_of_work_and_difficulty.go
@@ -3,9 +3,9 @@ package blockvalidator
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/model/pow"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/pow"
 	"github.com/kaspanet/kaspad/infrastructure/db/database"
 	"github.com/kaspanet/kaspad/infrastructure/logger"
 	"github.com/kaspanet/kaspad/util/difficulty"
diff --git a/domain/consensus/utils/mining/solve.go b/domain/consensus/utils/mining/solve.go
index 5b346837..84b60604 100644
--- a/domain/consensus/utils/mining/solve.go
+++ b/domain/consensus/utils/mining/solve.go
@@ -1,12 +1,12 @@
 package mining
 
 import (
-	"github.com/kaspanet/kaspad/domain/consensus/model/pow"
-	"github.com/kaspanet/kaspad/util/difficulty"
 	"math"
 	"math/rand"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/pow"
+	"github.com/kaspanet/kaspad/util/difficulty"
 	"github.com/pkg/errors"
 )
 


Test patch:
diff --git a/domain/consensus/processes/blockvalidator/pruning_violation_proof_of_work_and_difficulty_test.go b/domain/consensus/processes/blockvalidator/pruning_violation_proof_of_work_and_difficulty_test.go
index a22b58d4..bda80bca 100644
--- a/domain/consensus/processes/blockvalidator/pruning_violation_proof_of_work_and_difficulty_test.go
+++ b/domain/consensus/processes/blockvalidator/pruning_violation_proof_of_work_and_difficulty_test.go
@@ -10,13 +10,13 @@ import (
 	"github.com/kaspanet/kaspad/domain/consensus"
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/model/pow"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/blockheader"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/merkle"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/mining"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/pow"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/testutils"
 	"github.com/kaspanet/kaspad/util/difficulty"
 	"github.com/pkg/errors"
diff --git a/domain/consensus/model/pow/pow.go b/domain/consensus/utils/pow/pow.go
similarity index 100%
rename from domain/consensus/model/pow/pow.go
rename to domain/consensus/utils/pow/pow.go
diff --git a/testing/integration/mining_test.go b/testing/integration/mining_test.go
index ba18ef4b..304f872e 100644
--- a/testing/integration/mining_test.go
+++ b/testing/integration/mining_test.go
@@ -6,7 +6,7 @@ import (
 
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/model/pow"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/pow"
 	"github.com/kaspanet/kaspad/util/difficulty"
 )