<pre>
  PIP: 6
  Title: Salvage orphaned transactions
  Type: Backend 
  Impact: None
  Author: Herman Schoenfeld <i>&lt;herman@sphere10.com&gt;</i>
  Comments-URI: N/A
  Status: Active
  Created: 2017-05-01
</pre>

## Summary

When a block is orphaned, it's containing transactions should be re-added back to the Pending Pool and relayed to connected nodes. This ensures that operations never disappear from the blockchain once re-added, since they will be re-mined in future blocks when orphaned.

## Motivation

Many users have reported withdrawal transactions not being found in the PascalCoin blockchain. Whilst there could be many reasons for this, it is currently possible for operations to go missing in PascalCoin since this PIP functionality is not currently implemented. 

## Specification

When orphaning a set of blocks, the following additional steps should occur:
- Let Old = all operations from the set of orphaned blocks
- Let New = all operations from set of replacement blocks
- Let Orphans = New SET-SUBTRACTION Old
- For each operation x in Orphans
  - add x to the local nodes pending pool
  - notify all connected nodes of x
 
## Rationale

This functionality is standard across cryptocurrencies and should be present in PascalCoin.

## Reference Implementation

This PIP has been implemented in V2 by Albert Molina.

## Backwards Compatibility

Changes all fully backwards compatible.
